You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Erik Cederstrand (JIRA)" <ji...@apache.org> on 2017/02/06 12:35:42 UTC

[jira] [Created] (AIRFLOW-840) Python3 encoding issue in Kerberos

Erik Cederstrand created AIRFLOW-840:
----------------------------------------

             Summary: Python3 encoding issue in Kerberos
                 Key: AIRFLOW-840
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-840
             Project: Apache Airflow
          Issue Type: Bug
          Components: security
    Affects Versions: Airflow 1.8
         Environment: $ python --version
Python 3.4.3
            Reporter: Erik Cederstrand


While attempting to configure Kerberos ticket renewal in a Python3 environment, I encountered this encoding issue trying to run {{airflow kerberos}}:

{{
Traceback (most recent call last):
  File "/usr/local/bin/airflow", line 15, in <module>
    args.func(args)
  File "/usr/local/lib/python3.4/dist-packages/airflow/bin/cli.py", line 600, in kerberos
    airflow.security.kerberos.run()
  File "/usr/local/lib/python3.4/dist-packages/airflow/security/kerberos.py", line 110, in run
    renew_from_kt()
  File "/usr/local/lib/python3.4/dist-packages/airflow/security/kerberos.py", line 55, in renew_from_kt
    "\n".join(subp.stderr.readlines())))
TypeError: sequence item 0: expected str instance, bytes found
}}

The issue here (ignoring for a moment why {{kinit}} is failing on my machine) is that Popen in Python3 returns {{bytes}} for stdin/stdout, but both are handled as if they are {{str}}.

I'm unsure what the Py2/3 compat policy is at Airflow, but a simple {{from six import PY2}} and an if/else seems like the least intrusive fix. The non-PY2 path would then add something like {{subp.stdin.readlines().decode(errors='ignore')}}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)