How to disable spawnv's child process output messages

nushin nushin2 at
Wed Jul 23 20:30:32 CEST 2003

Hi Donn. Thanks for your response. Yes, in this case my parent process
is that is spwaning the child process, I
am simply printing a hello world from each process and do not wish to
see any output messages from the child process, and i *have to* see
the output from the parent process,

Could you please elaborate more on how i can use dup2( ) to disable
the output of the child process spawned by spawnv( ) API?

BB (Nushin)

"Donn Cave" <donn at> wrote in message news:<1058938603.850678 at yasure>...
> Quoth nushin2 at (nushin):
> | I have a program called that is spawned by
> |, using spawnv( ) API as:
> |
> | os.spawnv(os.P_NOWAIT,'/usr/bin/python',('python',''),('>/dev/null
> | &'))
> |
> | I do not wish to see any output messages from the when
> | it is launched by its parent process and i do wish to see *only* the
> | output messages from the parent process in the shell. Is Python
> | capable to so such a thing?
> What is the parent process in the shell?  You mean the one that calls
> spawnv()?  If so - yes, Python can do that.  But not so easily.  You
> can look at how spawnv is implemented (it's in Python), and read up
> on the dup2 function (man 2 dup2) to see what's needed.  spawnv can't
> do any kind of redirection.  I think I posted an example here a couple
> weeks ago.
> Or you can use the shell, more or less the way you were going but you
> never invoked it -
>   os.spawnv(os.P_NOWAIT, '/bin/sh', ['sh', '-c', 'python > /dev/null'])
> which is really about the same as
>   os.system('python > /dev/null &')
> 	Donn Cave, donn at

More information about the Python-list mailing list