You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Ash Berlin-Taylor (JIRA)" <ji...@apache.org> on 2018/08/21 12:46:00 UTC

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

     [ https://issues.apache.org/jira/browse/AIRFLOW-1791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ash Berlin-Taylor resolved AIRFLOW-1791.
----------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.9.0

> 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
>            Priority: Major
>             Fix For: 1.9.0
>
>
> 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
(v7.6.3#76005)