【发布时间】:2014-07-22 23:52:20
【问题描述】:
我刚刚安装了 python 27,我正在尝试通过我的 localhost 服务器运行一个 python 页面。我收到此错误:
HTTP 错误 502.2 - 网关错误 指定的 CGI 应用程序因未返回完整的 HTTP 标头集而行为异常。它返回的标题是“”。
import MySQLdb
db = MySQLdb.connect(host="localhost", # your host, usually localhost
user="root", # your username
passwd="pass", # your password
db="my_dbs") # name of the data base
cur = db.cursor()
cur.execute("SELECT * FROM myTable")
# print all the first cell of all the rows
for row in cur.fetchall() :
print(row[0])
我使用的是 Windows 7。
知道我做错了什么吗?是 IIS 配置问题吗?我有一个 python 处理程序映射:
pythonHandler
Path: *.py
State: Enabled
Path Type: Unspecified
Handler: CGIModule
Entry Type: Local
【问题讨论】: