When I am running CherryPy Hello World:
import cherrypy
class HelloWorld:
def index(self):
return \"Hello world!\"
index.exposed = True
che
I had the same problem when running CherryPy 3.2.2 on my Win7 PC with Python 3.3 The server would start normally and then would crash in about a couple of minutes.
I've applied the patch from CherryPy 3.2.3 laurasia mentioned. But it didn't help.
So I had to comment out the lines raising the error at the very end of python\Lib\site-packages\cherrypy\process\servers.py
to prevent the server from dying:
...
# if host == client_host(host):
# raise IOError("Port %r not bound on %r" % (port, host))
...
I ran into this problem yesterday on an Ubuntu Linux server. I spent a couple of hours trying to track down the bug in the CherryPy code before I realized that the error message is very generic. It will give this error message even if the host doesn't own the IP address to which the server is attempting to bind. In my case, the loopback interface (lo, 127.0.0.1) was disabled. Thus, even if I set server.socket_host='0.0.0.0'
, the attempt to check the port, wait_for_occupied_port
, would fail (as it assumes, reasonably, that the loopback interface is always available). After re-enabling the loopback interface, the CherryPy server would start up normally.
Update: CherryPy 3.2.3 has a fix for this particular issue. Until 3.2.3 is released, development builds are available on the CherryPy project downloads.
AVG Anti-Virus was causing this problem for me. Uninstalling AVG (far from ideal) did the trick. I suspect the link scanner that I couldn't disable.