[英]Python - CGI - (_urandom(16)), 16) WindowsError: [Error 5] Access is denied
Running this simple script for testing CGI setup. 运行此简单脚本以测试CGI设置。
#!/usr/bin/python
#import cgi
print "Content-Type: text/plain\n\n"
gender = "female"
def display_vars (first_name, last_name, age):
print (first_name, last_name, age, gender)
def go_display():
gender = "male"
display_vars("John", "Smith", 22)
go_display()
It works and displays "('John', 'Smith', 22, 'female')"
它可以正常工作并显示
"('John', 'Smith', 22, 'female')"
change the above from #import cgi
to import cgi
将以上内容从
#import cgi
更改为import cgi
and it fails. 它失败了。
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
(_urandom(16)), 16) WindowsError: [Error 5] Access is denied
In random.py section-_urandom set except NotImplementedError: to except: 在random.py部分-_urandom中,将NotImplementedError:设置为除外:
This works for me. 这对我有用。 If you have another answer please let me know and I will try that too.
如果您还有其他答案,请告诉我,我也会尝试的。
Add 加
print "HTTP/1.0 200 OK\n";
Before the content type header. 在内容类型标题之前。 You should Google your error message.
您应该在Google上显示错误消息。 You would have found this:
您会发现:
http://support.microsoft.com/kb/145661 http://support.microsoft.com/kb/145661
And also this: 还有这个:
http://forums.iis.net/t/1192084.aspx/1 http://forums.iis.net/t/1192084.aspx/1
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.