小编use*_*445的帖子

用python编写cgi脚本

我试图在python3中使用它作为服务器运行一个cgi脚本:

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()
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

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
Run Code Online (Sandbox Code Playgroud)

请帮忙.

python cgi

1
推荐指数
1
解决办法
3027
查看次数

标签 统计

cgi ×1

python ×1