[ https://issues.apache.org/jira/browse/AIRFLOW-436?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16605284#comment-16605284 ]
YH edited comment on AIRFLOW-436 at 9/6/18 5:34 AM: ---------------------------------------------------- Hi All I know this issue is resolved, but for those who want to know a simple workaround, simply add back the brackets after string format {code:java} template_string = "this is some string {var} {{var1}}" template_string.format(var='test') template_string.replace("{", "{{").replace("}", "}}"){code} was (Author: deedeeck): Hi All I know this issue is resolved, but for those who want to know a simple workaround, simply add back the brackets after string format ``` s.replace("\{", "{{").replace("}", "}}") ``` > Incorrect templating when used with .format > ------------------------------------------- > > Key: AIRFLOW-436 > URL: https://issues.apache.org/jira/browse/AIRFLOW-436 > Project: Apache Airflow > Issue Type: Bug > Reporter: Sumit Maheshwari > Priority: Major > > Found that when {{.format}} is used in a templatable field, it produces weird > results. For example: > {code:none} > t3 = BashOperator( > task_id='wget', > bash_command="wget {0}/{{ ds }}".format('google.com'), > dag=dag) > {code} > produces following result: > {code:none} > {bash_operator.py:79} INFO - Running command: wget google.com/{ ds } > {code} > But if we change {{bash_command}} to following, it works as expected: > {code:none} > bash_command="wget %s/{{ ds }}"%('google.com') > {code} > {code:none} > {bash_operator.py:79} INFO - Running command: wget google.com/2016-08-05 > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)