os.spawn

Sylvain Thenault syt at pegasus.logilab.fr
Wed Sep 12 16:33:23 CEST 2001


On Wed, 12 Sep 2001 09:13:58, S. Thenault <syt at pegasus.logilab.fr> wrote:
>On 11 Sep 2001 18:05:13 GMT, Donn Cave <donn at u.washington.edu> wrote:
>>Quoth syt at pegasus.logilab.fr (Sylvain Thenault):
>>
>>| how can I do for knowing what happend when I do an os.spawnv()
>>|
>>| for example, if i do
>>|
>>| import os
>>| os.spawnv(P_WAIT, '/bin/echo', 'this is a spawn test')
>>|
>>| I can't see anything, and don't know what have been made...
>>
>>Normal return from os.spawnv should be 0.  Anything else indicates
>>failure.
>>
>>   >>> print os.spawnv.__doc__
>>   spawnv(mode, file, args) -> integer
>>
>>   Execute file with arguments from args in a subprocess.
>>
>>Args here should be a tuple or list like sys.argv:
>>   os.spawnv(os.P_WAIT, '/bin/echo', ('echo', 'this is a spawn test'))
>>
>>	Donn Cave, donn at u.washington.edu
>
>thanks, i was waiting for an exception in case of error 
>does someone know why it isn't the default behaviour ?
>
>BTW, this wasn't working because as exec*, the first item of args must be 
>the called program's name ('echo' in this example)
as you said (i read your message too fast, didn't see you said that yet)

I have now another problem, I change P_WAIT to P_NOWAIT and spawnv return 
an integer != 0 either if spawnv succeed !

how to know if there is an error durring spawn with the P_NOWAIT flag?

-- 
Sylvain Thenault

LOGILAB




More information about the Python-list mailing list