process wrapper?
Steve @ Waypath
steve at waypath.com
Mon Mar 29 14:17:51 EST 2004
Donn,
Thanks for the reply. I haven't yet implemented a working spawnv call, so
I'm not confident my tests are valid. Here's a sample:
##########
File: test1.py
------------
import os, time
if __name__=='__main__':
os.spawnv(os.P_NOWAIT,'python',['test2.py'])
for step in range(10):
print 'test1 checking in'
time.sleep(1)
##########
File: test2.py
------------
import time
if __name__=='__main__':
for step in range(10):
print 'test2 checking in'
time.sleep(1)
##########
stdout:
# python test.py
test1 checking in
...
test1 checking in
[ 10 iterations of 'test1 checkin in'; none of 'test2 checking in']
###########
While test 1 is running, a ps (in another shell):
# ps x | grep python
11726 pts/1 S 0:00 python test1.py
11727 pts/1 Z 0:00 [python <defunct>]
11729 pts/2 S 0:00 grep python
###########
I see this defunct thing with every spawnv test I try. The defunct process
goes away when the calling process (test1.py, in this case) finishes. Where
am I going wrong here?
Thanks
Steve @ Waypath.com
"Donn Cave" <donn at drizzle.com> wrote in message
news:1080539401.173853 at yasure...
> Quoth "Steve @ Waypath" <steve at waypath.com>:
> ...
> | I've tried every implementation of os.system, os.popen*, os.spawn* , and
> | (os.fork + os.exec*) for which I can find an example or that I can
imagine,
> | but I can't come up with anything that works for me. os.spawnv() looked
> | very promising, but every process I start with it goes defunct.
>
> Well, you need to fix that, no? spawnv works for people, and very
> likely it's the perfect thing for your application. So start with
> a simple Python program that uses spawnv on some ordinary utility,
> like "date" for example, and if you can't get it to work you will
> have a more specific question to pose.
>
> Donn Cave, donn at drizzle.com
More information about the Python-list
mailing list