0
不確定問題出在哪。通過ssh正常工作。在瀏覽器中查看時,出現服務器錯誤。這是已知遷移到另一個服務器/環境的工作代碼。Python導入錯誤:沒有命名模塊 - 在ssh中工作,但在瀏覽器中不工作
它無法在目錄中找到清楚的模塊。對文件檢查的權限,他們看起來OK 755
內部服務器錯誤
服務器遇到一個內部錯誤或配置錯誤,無法完成您的請求。 請聯繫服務器管理員,告知發生錯誤的時間以及可能導致錯誤的任何事情。
有關此錯誤的更多信息可能在服務器錯誤日誌中可用。
ImportError: No module named xmlproducts
mod_python (pid=16232, interpreter='realtechy.com', phase='PythonHandler', handler='mod_python.cgihandler'): Application error
ServerName: 'realtechy.com'
DocumentRoot: '/var/www/vhosts/realtechy.com/httpdocs'
URI: '/products/myproducts.py'
Location: None
Directory: '/var/www/vhosts/realtechy.com/httpdocs/'
Filename: '/var/www/vhosts/realtechy.com/httpdocs/products/myproducts.py'
PathInfo: ''
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch\n default=default_handler, arg=req, silent=hlist.silent)
File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1229, in _process_target\n result = _execute_target(config, req, object, arg)
File "/usr/lib/python2.6/site-packages/mod_python/importer.py", line 1128, in _execute_target\n result = object(arg)
File "/usr/lib/python2.6/site-packages/mod_python/cgihandler.py", line 96, in handler\n imp.load_module(module_name, fd, path, desc)
File "/var/www/vhosts/realtechy.com/httpdocs/products/myproducts.py", line 6, in <module>\n import xmlproducts
ImportError: No module named xmlproducts
根據Python可執行文件的調用方式,「sys.path」(模塊搜索路徑)的內容可能不同。嘗試在失敗的導入之前打印'sys.path',以便驗證包含'xmlproducts'的目錄是否存在。 –