Catching exceptions of cherrypy.engine.start?

Shiming He <[email protected]> Wed, 9 Nov 2016 19:12:50 -0800 (PST)
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>
Hi,

When the port is occupied upon calling cherrypy.engine.start(), I'm seeing 
the following exceptions thrown at the console:

OSError: Port 8080 not free on '127.0.0.1'
cherrypy.process.wspbus.ChannelFailures: OSError("Port 8080 not free on 
'127.0.0.1'",)

Eventually, cherrypy will shutdown the entire Python process, regardless of 
the fact that I have something else running within the same process.

Usually in such situation, I can try to catch such exception, reconfigure 
the port and let cherrypy try again. However, putting try except block 
around engine.start() doesn't seem to do the trick. It appears the 
exception was caught in another thread.

My question is, how do I catch such exception, so that my process and keep 
trying for port instead of being terminated?

Best regards,
He Shiming

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.