2011-10-27 8 views
0

のApacheでmod_pythonのではPython Server Pagesの使用しようとすると、私はこのエラーが発生します:パイソン/ HTML統合エラー

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 
+0

mod_pythonは推奨されません。mod_wsgiを使用してください。 – gigimon

答えて

1

index.pspファイルには、ファイルの先頭にない__future__インポートが含まれているか、処理のためindex.pspファイルを含むファイルが多分あります__future__インポートがヒットしたために発生します。

+0

私はこれが当てはまると信じています - 私は__future__ imports –

0
from __future__ import print_function 

私はあなたがステートメントを実行するためにprint_functionをインポートする必要がないと思いますこのように

print("somthing") 

このインポートを試行しましたか?