subprocess seems to "detach" / ignore wait()

Wojtek Walczak gminick at bzt.bzt
Wed Aug 20 17:22:16 CEST 2008


On Wed, 20 Aug 2008 15:09:11 +0200, Mathieu Prevot wrote:

> flog = open(logfile, 'w')
> fpid = open(pidfile, 'w')
> try:
>   child = Popen(cmd.split(), stderr=flog)
>   print "Server running [PID %s]"%(child.pid)
>   fpid.write(child.pid)

What happens if you change:

fpid.write(child.pid)

into:

fpid.write('%d\n' % (child.pid))

I think that the problem here is that fpid.write() fails silently
(probably TypeError), because it takes string as its first argument,
not integer.

-- 
Regards,
Wojtek Walczak,
http://tosh.pl/gminick/



More information about the Python-list mailing list