[Tutor] Struggling with os.exec

Jeff Shannon jeff@ccvcorp.com
Wed May 21 14:31:03 2003


Charlie Clark wrote:

>On 2003-05-21 at 14:40:58 [+0200], you wrote:
>  
>
>>This doesn't answer your question, but couldn't you use:
>>    os.chdir(choices[go])
>>rather than os.execl.
>>    
>>
>
>No, because this only changes the directory within Python. This script is 
>to replace a shell script.
>

I'm not completely certain, but I believe that os.execl() will do the 
same thing.  Python runs in a child process of your shell session, and 
AFAIK a child process cannot change the environment of its parent.  A 
shell script, on the other hand, can run within the shell session and so 
*can* modify the environment.

Jeff Shannon
Technician/Programmer
Credit International