Python:3.6.8 Cheetah:3.2.4-1.el7 使用 2to3 程序将我的代码(Cheetah 外部)从 Python2 转换为 Python3 并将 Cheetah2 替换为 Cheetah3 后,出现以下错误。我参考了一些关于 StackOverflow 本身的文章,发现在 Python2 中,过滤器返回一个列表,而在 Python3 中,它返回一个需要转换为列表的迭代器。我查看了 Cheetah/Template.py,但不明白我应该在哪里进行建议的更改。
open(output_file_name,'wb').write( str(result) ) File "/srv/data/3rdParty/Cheetah/Template.py", line 1053, in __unicode__
return getattr(self, mainMethName)()
File "cheetah_DynamicallyCompiledCheetahTemplate_1618855414_917998_66948.py", line 125, in respond
TypeError: object of type 'filter' has no len()