【发布时间】:2019-03-01 19:22:37
【问题描述】:
使用 python 3 执行以下代码时出现错误,但在 python 2 上运行正常
template_content = <HTML data>
with NamedTemporaryFile(suffix='.html') as render_file:
render_file.write(template_content.encode('utf-8'))
render_file.seek(0)
stream = StringIO()
casperjs_capture(stream, url='file://%s' % os.path.abspath(render_file.name))
错误:
*** TypeError: string argument expected, got 'bytes'
【问题讨论】:
标签: django python-3.x python-2.7 casperjs