You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Shawn Wang (JIRA)" <ji...@apache.org> on 2017/11/08 07:12:00 UTC

[jira] [Created] (AIRFLOW-1791) Unexpected "AttributeError: 'unicode' object has no attribute 'val'" from Variable.setdefault

Shawn Wang created AIRFLOW-1791:
-----------------------------------

             Summary: Unexpected "AttributeError: 'unicode' object has no attribute 'val'" from Variable.setdefault
                 Key: AIRFLOW-1791
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1791
             Project: Apache Airflow
          Issue Type: Bug
          Components: core
    Affects Versions: Airflow 1.8
         Environment: Python 2.7, Airflow 1.8.2
            Reporter: Shawn Wang


In Variable.setdefault method,

{code:python}
        obj = Variable.get(key, default_var=default_sentinel, deserialize_json=False)
        if obj is default_sentinel:
            // ...
        else:
            if deserialize_json:
                return json.loads(obj.val)
            else:
                return obj.val
{code}

While obj is retrieved by "get" method which has already fetched the val attribute from obj, so this "obj.val" throws the AttributeError.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)