possible to preserve subprocess.Popen objects for later?

Ratko rjagodic at gmail.com
Thu Jun 21 18:32:29 EDT 2007


Hi all,

I have a python gui app that launches multiple applications using
subprocess.Popen class and prints their output in the gui (using
PIPEs, threads and wxPython). Everything works great but the problem
is that some applications should run in the background (ie they don't
close when the gui closes) so next time when you start the gui it will
not have a handle on those processes that are still running and
therefore won't be able to print their output.

So, I was wondering if there is any way to "preserve" the Popen object
of those background processes and reload them when the gui is
restarted? Ideally I would like to have the whole Popen object
preserved but I could also get by with just the Popen.stdout file
object. I can save the Popen.stdout.fileno() integer because that's
what I use in os.read() to read the output anyway but that doesn't
work.

I have doubts that this could even conceptually work but I thought I'd
try asking anyway. I don't have a full understanding of how processes
and pipes work on the system level...

Thanks,
Ratko




More information about the Python-list mailing list