我有这个测试 python 文件
import os
print 'Content-type: text/html'
print
print '<HTML><HEAD><TITLE>Python Sample CGI</TITLE></HEAD>'
print '<BODY>'
print "<H1>This is A Sample Python CGI Script</H1>"
print '<br>'
if os.environ.has_key('REMOTE_HOST'):
print "<p>You have accessed this site from IP: "+os.environ["REMOTE_HOST"]+"</p>"
else:
print os.environ['COMPUTERNAME']
print '</BODY></html>'
我在 IIS 5.1 上创建了一个具有执行脚本权限的应用程序,并创建了一个到 .py 的映射,如下所示:
C:\Python30\python.exe -u "%" "%"
但是当我尝试执行脚本时,出现以下错误:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
C:\Python30\python.exe: can't find '__main__.py' in ''
任何的想法?