cherrypy sub-process

Bart Van Loon bbbart at inGen.be
Sun Mar 11 16:49:51 EDT 2007


Hi all,

I have written a small program in Python which acts as a wrapper around
mpd and natd on a FreeBSD system. It gets the status, restarts the
processes, etc...

Then, I created a tiny cherrypy webapp which provides a webinterface to
this program. All works fine, but for the following problem:

cherrypy listens on port 1234. whenever I browse to that port and invoke
any action that involves (re)starting mpd or natd, which happens with
commands.getstatusoutput() (which uses os.popen()), I cannot restart
cherrypy without killing the mpd and/or natd processes spawned by it in
the previous session, because port 1234 willl still be in use.

lsof -i tcp tells me that it's exactly those mpd and/or natd processes
which are keeping that port 1234 from freeing up after I (succesfully)
kill cherrypy.

Is there any explanation to this, or, even better, a solution?

Thank you very much in advance.

-- 
regards,
BBBart

   "To make a bad day worse, spend it wishing for the impossible." -Calvin



More information about the Python-list mailing list