Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

173
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda