python problem: creating subprocess (it kills the parent process)

John Davis john.davis.85 at gmail.com
Thu Mar 29 16:26:07 EDT 2007


Hi all,
I am using Python 2.4. I am trying to run a C++ program on Red hat linux
enterprise edition from Python by using various methods like > Os.system
>
> Os.popen
>
> Subprocess.popen
>
> Os.execvp
>
> Os.spawnl
>

In all of these methods the program kills python program also. So, let's say
i am in python shell as follows

$> python
Python 2.4.4 (#1, Mar 28 2007, 15:30:40)
[GCC 3.4.5 20051201 (Red Hat 3.4.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>>os.system('program_name')
.......
.......
#program_output
.......
.......
No more foreground apps, exiting
Signal received. Terminating
Signal received. Terminating
.......
.......
Hangup
......
......
$>

That is I exit the python shell as well. Please notice that Hangup written
in between which is not a part of the program output (i.e. I don't get this
'Hangup'  when I run the program independently from the command prompt). The
other things are part of the program output on stdout & stderr. Can anybody
give some pointers on how to solve this. I am running out of ideas on how to
run this program without exiting the python shell.


Thx
John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070329/32f1985c/attachment.html>


More information about the Python-list mailing list