execute command in CURRENT shell

Rich Drewes pydrew01 at interstice.com
Fri Aug 8 21:46:26 CEST 2003


Rob Williscroft wrote:

>Valentine Kouznetsov wrote in news:ec6d1a16.0308080828.367f6b54
>@posting.google.com:
>
>  
>
>>Hi,
>>simple question, how to execute command in current shell, not in
>>subshell?
>>
execl() will execute a new program in the current process, replacing the 
current process.  It obviously cannot return back to Python.  See 
http://www.python.org/doc/2.2/lib/os-process.html .

spawnl() will execute a new program in a new process, but it does not 
invoke a new *shell*.  It allows you to completely specify the 
environment, so this may also do what you want.  Unlike execl() you can 
return to Python after the subprocess is complete.

Rich






More information about the Python-list mailing list