当我试图(通过本地主机)来执行CGI脚本,我得到以下错误
When I try to execute a cgi script (via a localhost), I get the following error
OSError: [WinError 193] %1 is not a valid Win32 application
任何想法,为什么 ??
完全失去...
补充说明:的
该本地主机是由生成以下
The localhost is generated by the following
蟒蛇-m http.server --cgi 8000
CGI脚本被称为一个Ajax'得到'请求(简体)
The cgi script is called by an ajax 'get' request (simplified)
ajax({
type: "GET",
url: "cgi-bin/myScript.cgi",
onSuccess: function(html){
//do stuff
}
});
我已经测试,以检查它是否是CGI脚本的造成这一内容,我相信这不是问题。举例来说,如果我尝试的方式执行空myScript.cgi上面,我仍然得到错误。
I have tested to check whether it's the contents of the cgi script causing this and I am convinced it's not the problem. For instance, if I try to execute an empty 'myScript.cgi' in the manner above, I still get the error.
此外,通过命令行运行时给CGI脚本(Python编写的)工作正常。
Also, the cgi script (written in python) works fine when run through the command line.
所以,原来这是一个服务器配置错误....
So turns out it was a server config error....
我碰到这个教程中,
HTTP://anh.cs.luc。埃杜/蟒蛇/动手/ 3.1 / handsonHtml / dynamic.html
而在这里引用可用localCGIServer.py脚本,
which references a localCGIServer.py script available here,
HTTP://anh.cs.luc。埃杜/蟒蛇/动手/例子/ WWW / localCGIServer.py
和服务器脚本能够完成任务
And the server script gets the job done
*
对于Python 3改变这一行
For Python 3 change this line
cgiServer = BaseHTTPServer.HTTPServer(SERVER_ADDR,CGIExtHTT prequestHandler)
到
cgiServer = http.server.HTTPServer(SERVER_ADDR,CGIExtHTT prequestHandler)
上一篇:文件下载使用Ajax和iframe下载使用、文件、iframe、Ajax
下一篇:电话号码:selectOneRadio不更新模型,事件和QUOT;变"与号码:阿贾克斯电话号码、模型、号码、事件