os.system('cd dir1 ... and executing next os.system command in that directory (dir1)
Gerhard Häring
gh at ghaering.de
Tue Aug 12 08:43:16 EDT 2003
Sami Viitanen wrote:
> Hello,
>
> I'm having problems with os.system.
>
> If I execute some 'cd directory' command with it, after that the script is
> on the
> same directory level as it was before the command.
>
> Any ideas ?
If you use os.system, any environment or current directry changes there
will only affect your shell and the child processes of it, but never the
parent process (Python). This is true for at least Windows and *nix.
By the way, why don't you just use os.chdir? :)
-- Gerhard
More information about the Python-list
mailing list