Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

169
Views
Run a python script on a Apache server with multible imports

So, I'm pretty new to this whole thing. I try to set up a button on the website which then executes a python file by pressing. I'm done with the installation of apache2, wordpress and the CGI-setup. I'm able to edit my side with wordpress and I'm able to start a small python program ('first.py')

#!/usr/bin/python3
import cgitb

#from influxdb import InfluxDBClient
#import yaml

cgitb.enable()

print("Content-Type: text/html;charset=utf-8")
print ("Content-type:text/html\r\n")
print("<H1> Hello, From python server :) </H1>")
The result is:
curl http://localhost/cgi-bin/first.py
<H1> Hello, From python server :) </H1>

with the CGI... so everything done and set up. BUT...

If i try to import my lib's like yaml or Influx then there always occur the same Errormessage

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an internal error or
misconfiguration and was unable to complete
your request.</p>
<p>Please contact the server administrator at
 webmaster@localhost to inform them of the time this error occurred,
 and the actions you performed just before this error.</p>
<p>More information about this error may be available
in the server error log.</p>
<hr>
<address>Apache/2.4.38 (Raspbian) Server at localhost Port 80</address>
</body></html>

And yes... Ofcause i installed those modules... I have several files which uses these import continously with no problem at all.

So... i think the modules are not installed on apache or they could not be found. Has anyone an idea how to import the modules correctly... it is nearly useless if i cant use python without the neccessary imports!

can anybody please help... this is my final exam...

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!