[
https://issues.apache.org/jira/browse/AIRFLOW-1791?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16253833#comment-16253833
]
Ash Berlin-Taylor commented on AIRFLOW-1791:
--------------------------------------------
Fixed by 1177, merged and will included in 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
>
> 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)