是否已准备好在Windows 7 64位和Python3.2.3上运行?
我非常感谢大家对我下面列出的问题的答案。希望你这次可以帮助我?
我正在尝试在Windows 7计算机上运行cherrypy。我已经安装了cherrypy使用:pip install cherrypy。当我运行琐碎的“Hello World”时:
import cherrypy
class HelloWorld(object):
def index(self):
print('Hello world will be returned')
return 'Hello world!'
print('index.exposed = True')
index.exposed = True
cherrypy.config.update({'server.socket_host': '0.0.0.0'})
print('cherrypy.quickstart(HelloWorld())')
cherrypy.quickstart(HelloWorld())
我明白了:
C:\Python32>python hello.py
index.exposed = True
cherrypy.quickstart(HelloWorld())
[11/Apr/2014:07:41:16] ENGINE Listening for SIGTERM.
[11/Apr/2014:07:41:16] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.
[11/Apr/2014:07:41:16] ENGINE Set handler for console events.
[11/Apr/2014:07:41:16] ENGINE Started monitor thread '_TimeoutMonitor'.
[11/Apr/2014:07:41:16] ENGINE Started monitor thread 'Autoreloader'.
[11/Apr/2014:07:41:17] ENGINE Serving on 0.0.0.0:8080
[11/Apr/2014:07:41:17] ENGINE Bus STARTED
[11/Apr/2014:07:41:17] ENGINE Error in HTTPServer.tick
Traceback (most recent call last):
File "C:\Python32\lib\site-packages\cherrypy\wsgiserver\wsgiserver3.py", line 1563, in start
self.tick()
File "C:\Python32\lib\site-packages\cherrypy\wsgiserver\wsgiserver3.py", line 1618, in tick
prevent_socket_inheritance(s)
File "C:\Python32\lib\site-packages\cherrypy\wsgiserver\wsgiserver3.py", line 1324, in prevent_socket_inheritance
raise WinError()
WindowsError: [Error 6] The handle is invalid.
如果我尝试从浏览器访问localhost:8080,程序会“响应”两次:
[11/Apr/2014:07:57:41] ENGINE Error in HTTPServer.tick
Traceback (most recent call last):
File "C:\Python32\lib\site-packages\cherrypy\wsgiserver\wsgiserver3.py", line 1563, in start
self.tick()
File "C:\Python32\lib\site-packages\cherrypy\wsgiserver\wsgiserver3.py", line 1618, in tick
prevent_socket_inheritance(s)
File "C:\Python32\lib\site-packages\cherrypy\wsgiserver\wsgiserver3.py", line 1324, in prevent_socket_inheritance
raise WinError()
WindowsError: [Error 6] The handle is invalid.
索引方法似乎没有运行,因为浏览器dosnt收到“Hello World”文本。
我查看了wsgiserver3.py文件,可以找到指示的行,并在第1324行看到:
if not windll.kernel32.SetHandleInformation(sock.fileno(), 1, 0):
raise WinError()
从这里我迷失了方向。它让我担心它会说windll.kernel32 ....应该是64而不是32才能工作吗?