[Tutor] Struggling with os.exec

Charlie Clark charlie@begeistert.org
Wed May 21 11:02:02 2003


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.
 
> One possible cause for your execl problem is that cd may not be an 
> executable. Usually cd is a command within a shell (I have no BeOS 
> experience).  In that case, os.system("cd %s" % choices[go]) might work 
> for you.  However, os.chdir should be the best option.  The books, 
> "Python Standard Library" and "Python in a Nutshell" cover these topics.

I have both and read them both first but couldn't find enlightenment. BeOS 
has a bash (2.03) shell so this is essentially a "posix" question and "cd" 
is obviously a built-in command. Is it still possible to call "cd" from 
within Python?

Charliey