TemplateSyntaxError:在 205 Airflow 宏中出现意外字符 u'\\' [英] TemplateSyntaxError: unexpected char u'\\' at 205 Airflow Macros

查看:22
本文介绍了TemplateSyntaxError:在 205 Airflow 宏中出现意外字符 u'\\'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误:

File "<unknown>", line 1, in template
TemplateSyntaxError: unexpected char u'\\' at 205        

当我将其包含在我的代码中时:

When I include this in my code:

'{{ macros.ds_format(macros.ds_add(ds, -13), "%Y-%m-%d", "%Y%m%d") }}'

我在vim中重新输入,以防编码错误,但仍然没有运气!

I re-typed it in vim in case it was an error with encoding, but still no luck!

推荐答案

改为:

"{{ macros.ds_format(macros.ds_add(ds, -13), '%Y-%m-%d', '%Y%m%d') }}"

Airflow jinja 模板不接受 "在你的模板中间.我使用相同的 ds_format 宏遇到了同样的问题.始终用 ' 表示模板中的字符串,例如:'my_string',它应该可以工作.

Airflow jinja templates does not accept " in the middle of your template. I've had this same problem using this same ds_format macro. Always represents strings inside your template with ', for example: 'my_string', and it should work.

这篇关于TemplateSyntaxError:在 205 Airflow 宏中出现意外字符 u'\\'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆