gpt4 book ai didi

python - CherryPy 无法绑定(bind)到端口

转载 作者:太空宇宙 更新时间:2023-11-04 09:33:19 26 4
gpt4 key购买 nike

感谢大家的专业知识。我们正在运行一个使用 Cherrypy 的 python 服务器来公开/处理我们的 API。这在将 Ubuntu 10.10 升级到 11.04(使用固有的 python 更新)之前运行良好,但不幸的是,从那时起 CherryPy 没有绑定(bind)到端口 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 可能不具有约束力吗?

最佳答案

我卸载了 CherryPy 并重新安装了 CherryPy 到最新版本 (3.2),问题自行解决。

关于python - CherryPy 无法绑定(bind)到端口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29244894/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com