首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Hello world失败

Hello world失败
EN

Stack Overflow用户
提问于 2011-07-24 22:36:13
回答 1查看 734关注 0票数 3

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

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

代码语言:javascript
复制
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

我遗漏了什么?

代码:

代码语言:javascript
复制
import cherrypy

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

cherrypy.quickstart(HelloWorld())

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

EDIT2:第二个好处-如果我用Python2.7.2安装它,一切都能正常工作,所以似乎这只是3.x的问题(我也尝试了3.0.1 -同样的问题)

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-07-25 20:05:55

我遇到了两个错误:

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

2-如果您使用个人防火墙或处理超文本传输协议保护的杀毒软件,请确保他没有保护8080端口,例如,ESET antivirus不会让您使用8080,CherryPy会说该端口不可用。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6807428

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档