Python 3.x 你好,世界失败了

Python 3.x 你好,世界失败了,python-3.x,cherrypy,Python 3.x,Cherrypy,我刚刚在Windows 7上安装了python 3.2.1(32位)和cherrypy 3.2.1(cherrypy-3.2.1.win32-py3.exe),并尝试了hello world示例(通过PyScripter执行),但它在引擎总线启动消息后挂起 如果我尝试通过python.exe启动它,我会得到以下日志: C:\Program Files (x86)\Python32>python hello.py [24/Jul/2011:16:24:03] ENGINE Listening

我刚刚在Windows 7上安装了python 3.2.1(32位)和cherrypy 3.2.1(cherrypy-3.2.1.win32-py3.exe),并尝试了hello world示例(通过PyScripter执行),但它在引擎总线启动消息后挂起

如果我尝试通过python.exe启动它,我会得到以下日志:

C:\Program Files (x86)\Python32>python hello.py
[24/Jul/2011:16:24:03] ENGINE Listening for SIGTERM.
[24/Jul/2011:16:24:03] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.

[24/Jul/2011:16:24:03] ENGINE Started monitor thread 'Autoreloader'.
[24/Jul/2011:16:24:03] ENGINE Started monitor thread '_TimeoutMonitor'.
[24/Jul/2011:16:24:03] ENGINE Serving on 127.0.0.1:8080
[24/Jul/2011:16:24:03] ENGINE Bus STARTED
Exception in thread CP Server Thread-4:
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python32\lib\site-packages\cherrypy\wsgiserver\ws
giserver3.py", line 693, in read_request_headers
    read_headers(self.rfile, self.inheaders)
  File "C:\Program Files (x86)\Python32\lib\site-packages\cherrypy\wsgiserver\ws
giserver3.py", line 202, in read_headers
    raise ValueError("Illegal end of headers.")
ValueError: Illegal end of headers.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Python32\lib\site-packages\cherrypy\wsgiserver\ws
giserver3.py", line 1024, in communicate
    req.parse_request()
  File "C:\Program Files (x86)\Python32\lib\site-packages\cherrypy\wsgiserver\ws
giserver3.py", line 578, in parse_request
    success = self.read_request_headers()
  File "C:\Program Files (x86)\Python32\lib\site-packages\cherrypy\wsgiserver\ws
giserver3.py", line 696, in read_request_headers
    self.simple_response("400 Bad Request", ex.args[0])
  File "C:\Program Files (x86)\Python32\lib\site-packages\cherrypy\wsgiserver\ws
giserver3.py", line 840, in simple_response
    status = str(status)
TypeError: 'tuple' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Python32\lib\threading.py", line 736, in _bootstr
ap_inner
    self.run()
  File "C:\Program Files (x86)\Python32\lib\site-packages\cherrypy\wsgiserver\ws
giserver3.py", line 1174, in run
    conn.communicate()
  File "C:\Program Files (x86)\Python32\lib\site-packages\cherrypy\wsgiserver\ws
giserver3.py", line 1080, in communicate
    req.simple_response("500 Internal Server Error", format_exc())
  File "C:\Program Files (x86)\Python32\lib\site-packages\cherrypy\wsgiserver\ws
giserver3.py", line 840, in simple_response
    status = str(status)
TypeError: 'tuple' object is not callable
我错过了什么

代码:

编辑:奖金信息:我尝试了各种方法来补救这种情况,但没有结果。安装64位版本的python没有帮助,因为cherrypy不支持64位(除非我弄错了)。我尝试重新安装python和cherrypy软件包,并尝试停用所有其他可能阻止它的东西(IIS)。一切都无济于事:-(


EDIT2:第二个好处-如果我用python 2.7.2安装它,一切都会正常工作,因此似乎这只是3.x的一个问题(我也尝试过3.0.1-同样的问题)

我遇到了两个错误:

1-在启动脚本之前打开浏览器,这样就不会有任何问题


2-如果您使用个人防火墙或处理HTTP保护的防病毒软件,请确保他没有保护8080端口,例如,ESET antivirus不会让您使用8080,CherryPy会说该端口不是免费的。

因为它在python 2.7.2中工作-Suggestion都不成立。在python 3中,它们将二进制和文本分开,因此这就是为什么WSGI和python3中存在问题的原因,所以我认为这是一个问题,我不知道这个问题是否已经解决,因为我从python3和internet开始…啊,谢谢!听起来很合理-我刚从python3和web开始:-)希望他们能解决这个问题,因为cherrypy是目前运行python3.x的唯一web模块。有一个叫做Web3的模块,我想他们是在谈论这个问题
import cherrypy

class HelloWorld:
    def index(self):
        return "Hello world"
    index.exposed = True

cherrypy.quickstart(HelloWorld())