En Wed, 20 Aug 2008 12:22:16 -0300, Wojtek Walczak <[EMAIL PROTECTED]> escribió:

> On Wed, 20 Aug 2008 15:09:11 +0200, Mathieu Prevot wrote:
>
>>   child = Popen(cmd.split(), stderr=flog)
>>   print "Server running [PID %s]"%(child.pid)
>>   fpid.write(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.

Exactly, but it doesn't fail "silently" (that would be a bug). The exception is 
raised, but due to the finally clause ending in sys.exit(0), it has no chance 
of being handled.
This is the original code, for reference:

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)
  child.wait()
except KeyboardInterrupt:
  print "INT sent to vnc server"
finally:
  fpid.close()
  flog.close()
  os.remove(pidfile)
  os.remove(logfile)
  sys.exit(0)

-- 
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to