os.system('cd dir1 ... and executing next os.system command in that directory (dir1)

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Tue Aug 12 14:23:19 CEST 2003


Sami Viitanen wrote:
> 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 ?

os.system creates a new process that executes your command.
Python's own process is not affected.

You'll want to use os.chdir instead :-)

--Irmen





More information about the Python-list mailing list