运行这个简单的脚本来测试 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()
它工作并显示"('John', 'Smith', 22, 'female')"
将上述内容从更改#import cgi
为import cgi
它失败了。
The specified CGI application misbehaved by not returning a complete set of HTTP headers.
(_urandom(16)), 16) WindowsError: [Error 5] Access is denied