0

I tried to run a CGI python file, I am new to html and server side programming. I wanted to a python scrip on my webserver(Wamp) so I searched and found that I could use Apache. I dropped my code in a .py file and put it in the cgi-bin folder. When I run it I get an error, mind that I stole the test code from the python website to test it.

#!/usr/bin/env python
# -*- coding: UTF-8 -*-

# enable debugging
import cgitb
cgitb.enable()

print("Content-Type: text/plain;charset=utf-8")
print()

print("Hello World!")

This is the error I get:

[Thu Jul 09 14:11:58.841220 2015] [cgi:error] [pid 9940:tid 968] [client ::1:54621] script not found or unable to stat: C:/wamp/bin/apache/apache2.4.9/cgi-bin/CgiTest.py
[Thu Jul 09 14:26:59.338627 2015] [cgi:error] [pid 5500:tid 968] (OS 2)The system cannot find the file specified.  : [client ::1:54733] couldn't create child process: 720002: CgiTest.py
[Thu Jul 09 14:26:59.338627 2015] [cgi:error] [pid 5500:tid 968] (OS 2)The system cannot find the file specified.  : [client ::1:54733] AH01223: couldn't spawn child process: C:/wamp/bin/apache/apache2.4.9/cgi-bin/CgiTest.py

I have made sure the name is correct. I get a 500 internal error. I have also made sure I have checked cgi-modules in the wamp server tray icon.

SQL.injection
  • 2,607
  • 5
  • 20
  • 37
Smashed
  • 331
  • 2
  • 5
  • 20
  • So have you installed Python so there is something on your system to interpret and execute the Python code? Have you enabled CGI in Apache? This may help you http://stackoverflow.com/questions/2137394/how-to-setup-and-run-python-on-wampserver – RiggsFolly Jul 09 '15 at 12:14
  • yes I have done everything, have wamp, python 3.4.2. I have also checked the cgi-modules in the Apache – Smashed Jul 09 '15 at 14:24
  • Maybe your shebang `#!/usr/bin/env python` needs a little modification to fit a windows environment – RiggsFolly Jul 09 '15 at 18:43
  • Figured it out, some of the modulus are only 2.7+ not 3.4. I needed to downgrade – Smashed Jul 10 '15 at 04:26

0 Answers0