Python reference

Grant Edwards grante at
Thu Jun 3 22:41:05 CEST 2004

On 2004-06-03, Reiner Block <reiner.block at> wrote:

> -----------------------------------------------------------------------
> import os
> os.spawnlp(os.P_WAIT, 'cp', 'cp', 'index.html', '/dev/null')
> -----------------------------------------------------------------------
> There is no further explaination why there are suddenly two times 'cp'! The
> first says the first parameter is the mode like P_WAIT or P_NOWAITE. That's
> clear. But the second should be the program to start and the third...? :-( 
> It is not clear why the 2nd and 3rd parameter are the same.

The 2nd parameter is the filename of the program to be

The 3rd parameter is the value of the first argument to be
passed to that program.  

It is traditional on Unix systems to pass the program's name to
it as its first parameter.  Some programs will behave
differently if different names are passed as that first
parameter -- allowing a single executable file to take the
place of several (usually slightly) different programs by
simply changing its name.

Grant Edwards                   grante             Yow!  RELATIVES!!

More information about the Python-list mailing list