user1841445
user1841445

Reputation: 35

cgi scripts with python

I tries to run a cgi-script using this as server in python3:

from http.server import HTTPServer, CGIHTTPRequestHandler

port = 8080

httpd = HTTPServer(('', port), CGIHTTPRequestHandler)
print("Starting simple_httpd on port: " + str(httpd.server_port))
httpd.serve_forever()

but I got the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.2/http/server.py", line 1110, in run_cgi
    os.execve(scriptfile, args, env)
OSError: [Errno 2] No such file or directory
localhost - - [21/Nov/2012 10:28:26] CGI script exit status 0x7f00

Please Help.

Upvotes: 1

Views: 3736

Answers (1)

Leopold
Leopold

Reputation: 76

hope these help: 1. check whether the script you are going to execute is executable? if it is not -rwx, it can not be execute 2. check the the top line of the script, i.e., #! ..... if this line does not correctly point to the folder of your python, it still can not be execute

Upvotes: 5

Related Questions