Why am I getting an Internal Server error

非 Y 不嫁゛ 提交于 2021-02-08 10:10:20

问题


My python script runs just fine on the Apache server locally set up on my computer, however, on importing the json2html library I am getting an internal server error

The moment I comment the import statement out , it seems to work. I even tried importing just the functions from the library , thinking maybe it is a space constraint or so.

 #!/usr/bin/python
import cgi,cgitb
 #import json2html#this has the errir
import cassandra
from cassandra.cluster import Cluster
from cassandra.auth import PlainTextAuthProvider

Internal Server Error

From logs: ImportError: No module named json2html [Tue Jun 11 15:42:52.495135 2019] [cgid:error] [pid 2235:tid 140698967865088] [client 127.0.0.1:35474] End of script output before headers: show.py, referer: http://test.com/ Traceback (most recent call last): File "/home/arjun/Cassandra/website_test/show.py", line 6, in from json2html import *

The module works fine on my system and dosen't give any errors,but it seems to have a problem when running on the server.

Can somebody help fix this?


回答1:


The server may be running under a different user. In that case, you may have installed json2html in a location that the Apache server user cannot access.

To check this, run a small script that prints sys.version both locally and in the server. If there is a mismatch, then try installing json2html either:

  • under the Apache server user
  • system-wide using pip


来源:https://stackoverflow.com/questions/56542002/why-am-i-getting-an-internal-server-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!