【发布时间】:2015-05-28 11:42:47
【问题描述】:
感谢大家的专业知识。我们正在使用 Cherrypy 运行一个 python 服务器来公开/处理我们的 API。在将 Ubuntu 10.10 升级到 11.04(带有固有的 python 更新)之前,它可以正常运行,但不幸的是,从那时起 CherryPy 并没有绑定到端口 80(使用代理端口 9998)。错误转储如下:
2015-03-24 23:21:16,610 cherrypy.error - INFO - [24/Mar/2015:23:21:16] ENGINE PID 17194 written to '/var/tmp/MYSERVERNAME.pid'.
2015-03-24 23:21:16,611 cherrypy.error - INFO - [24/Mar/2015:23:21:16] ENGINE Started monitor thread '_TimeoutMonitor'.
2015-03-24 23:21:16,611 cherrypy.error - INFO - [24/Mar/2015:23:21:16] ENGINE Started monitor thread 'Autoreloader'.
2015-03-24 23:21:21,771 cherrypy.error - ERROR - [24/Mar/2015:23:21:21] ENGINE Error in 'start' listener <bound method Server.start of <cherrypy._cpserver.Server object at 0x12ffa90>>
Traceback (most recent call last):
File "/usr/lib/pymodules/python2.7/cherrypy/process/wspbus.py", line 147, in publish
output.append(listener(*args, **kwargs))
File "/usr/lib/pymodules/python2.7/cherrypy/_cpserver.py", line 90, in start
ServerAdapter.start(self)
File "/usr/lib/pymodules/python2.7/cherrypy/process/servers.py", line 60, in start
self.wait()
File "/usr/lib/pymodules/python2.7/cherrypy/process/servers.py", line 101, in wait
wait_for_occupied_port(host, port)
File "/usr/lib/pymodules/python2.7/cherrypy/process/servers.py", line 266, in wait_for_occupied_port
raise IOError("Port %r not bound on %r" % (port, host))
IOError: Port 9998 not bound on '127.0.0.1'
运行 netstat 看看是什么占用了端口显示:
alpha$ sudo netstat -pnl | grep 8080
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 17194/python
如您所见,PID 为 17194 的 python 服务器启动,启动cherrypy(失败)。我不确定什么与这里的内容发生冲突。正如您可能会说的,我不是服务员,但这并不能阻止我乱搞乱搞!任何人都知道为什么 CherryPy 可能没有绑定?
【问题讨论】:
标签: python linux python-2.7 python-2.6 cherrypy