Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

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

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...