popen child termination

Jeff Epler jepler at unpythonic.net
Sat Aug 21 15:12:50 CEST 2004


Why are you using popen instead of system?  Is it to discard the output
from the program?  If so, your best choice would be to use shell
redirection in system().  system() already waits for the child to exit.
If you really want to use popen, the class-based interface (Popen3,
Popen4) will give you an object with a pid attribute and wait() and
poll() methods to check for exiting.

BUT your real problem is that os.remove doesn't expand paths.  Use
os.path.expanduser:
    os.path.exists("~")                     -> 0
    os.path.exists(os.path.expanduser("~")) -> 1

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040821/88f9dc07/attachment.pgp>


More information about the Python-list mailing list