我在Apache中尝试将Python服务器页与Mod\u Python一起使用时收到以下错误:
File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1537, in HandlerDispatch
default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1229, in _process_target
result = _execute_target(config, req, object, arg)
File "/usr/lib/python2.7/dist-packages/mod_python/importer.py", line 1128, in _execute_target
result = object(arg)
File "/usr/lib/python2.7/dist-packages/mod_python/psp.py", line 336, in handler
p = PSP(req)
File "/usr/lib/python2.7/dist-packages/mod_python/psp.py", line 119, in __init__
self.load_from_file()
File "/usr/lib/python2.7/dist-packages/mod_python/psp.py", line 191, in load_from_file
code = compile(source, filename, "exec")
File "/var/www/inventory/index.psp", line 3
<% from __future__ import print_function
SyntaxError: from __future__ imports must occur at the beginning of the file
看起来像你的索引.psp文件的
__future__
导入不在文件顶部,或者(更可能是imo)包含索引.pspfor processing在命中__future__
导入之前执行了大量工作,从而导致错误。在我认为您不必导入
^{pr2}$print_function
来做这样的语句你试过没有这个进口的吗?在
相关问题 更多 >
编程相关推荐