Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
229 views
in Technique[技术] by (71.8m points)

python - Why am I getting an Internal Server error

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...