process wrapper?

Steve @ Waypath steve at
Mon Mar 29 22:59:18 CEST 2004

"Donn Cave" <donn at> wrote in message
news:donn-440440.12045829032004 at
> In article <QZ2dnbPGnqPo6_Xd38DK-g at>,
>  "Steve @ Waypath" <steve at> wrote:
> > ##########
> > File:
> > ------------
> > import os, time
> > if __name__=='__main__':
> >  os.spawnv(os.P_NOWAIT,'python',[''])
> But don't give it python's path.  Instead, at least consider
> invoking the Python program file directly - put its path there
> as the 2nd parameter, not python's.  Then your argument list
> (the 3rd parameter) will be correct as written.  If you invoke
> python itself, then you'll need to make the second
> argument, directing python to interpret that file.  If you
> decide to do as I suggest, will have to be executable
> (chmod 755) and start with a line like "#!/usr/bin/python", as
> appropriate for your system.  From there on, your
> program no longer needs to know how is actually
> implemented.

This makes sense to me. I tried this originally, and tried again just now.
For reasons not clear to me, I get the error:
      bad interpreter: No such file or directory
when I include the path to the python interperter. I've tried a number of
  #!/usr/bin/env python

(I've got the x bit set on the test files, so it's not a permissions
problem. ) This, I'm guessing, isn't a python problem, and would seem to be
my roadblock. I've done some preliminary searches for an answer, but nothing
has panned out so far; if anyone has any ideas...

> > ###########
> > While test 1 is running, a ps (in another shell):
> > # ps x | grep python
> > 11726 pts/1  S   0:00  python
> > 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
> > goes away when the calling process (, in this case) finishes.
> > am I going wrong here?
> It's a zombie!  UNIX leaves a dead process in the table as
> long as its parent might come back and ask for the status.
> It goes either when the parent gets its status with a wait
> function (like waitpid()), or when the parent exits.

I've read other posts (many yours, I think :) indicating something like
this, but I confess I don't understand the relationship between waitpid()
and spawnv(), how I would use the former with the latter. However, as I
recognize that isn't the solution to my problem, I won't ask you to explain
it--unless you really want to. :)

>    Donn Cave, donn at

More information about the Python-list mailing list