Why am I getting an Internal Server error

2024/10/8 2:19:32

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?

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
https://en.xdnf.cn/q/118749.html

Related Q&A

Save pixel data in txt format in PIL

My program is to extract the pixel from an image and to save the pixel data in the text file for analysis. My picture is a binary image that gives only 255 and 0 sHere is the program:from PIL import Im…

ValueError: view limit minimum 0.0 is less than 1 and is an invalid Matplotlib date value

Ive been given the python script where matplotlib is used , when running the script it opens the window and display graph. its working perfectly on my laptop. But this error occurs when I upload the fi…

Python win32com Outlook Stores not iterable

Trying to list all Outllook stores (and finally all e-mails in those stores):import win32com.clientoutlook = win32com.client.Dispatch("Outlook.Application").GetNamespace("MAPI") sto…

Using a users input to search dictionary keys and print that keys matching value

I am working with tkinter, as I have my gui set up with and entry, label, and button. Im trying to search my dictionarys keys with the users input from the entry, and print the value of the key that wa…

How to write CSV into the next column

I have output that I can write into a CSV. However, because of how i setup my XML to text, the output iterates itself incorrectly. Ive tried a lot to fix my XML output, but I dont see any way to fix it…

Comparing date from pandas dataframe to current date

Im currently trying to write a script that does a specific action on a certain day. So for example, if today is the 6/30/2019 and in my dataframe there is a 6/30/2019 entry, xyz proceeds to happen. How…

How to divide a binary file to 6-byte blocks in C++ or Python with fast speed? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Update the question so it focuses on one problem only by editing this post.Closed 5…

Selenium, python dynamic table

Im creating a robot with selenium that get all info from agencies in Brasil, ive alredy done the permutation click between all States and counties, all i have to do nows click in all agencies and get i…

How to split string into column

I got a csv file with some data, and I want to split this data.My column one contains a title, my column 2 contains some dates, and my column 3 contains some text linked to the dates.I want to tran…

remove whitespaces with new line characters

I have a string that looks like that:"\n My name is John\n and I like to go.\n blahblahblah.\n \n\n ".Note - In this string example, there are 5 white-spaces after…