cd Terminal at a given directory after running a Python script?

Posted by Dave Everitt on Stack Overflow See other posts from Stack Overflow or by Dave Everitt
Published on 2010-05-09T21:30:51Z Indexed on 2010/05/09 21:38 UTC
Read the original article Hit count: 235

Filed under:
|
|
|
|

I'm working on a simple Python script that can use subprocess and/or os to execute some commands, which is working fine.

However, when the script exits I'd like to cd the actual Terminal (in this case OS X) so on exit, the new files are ready to use in the directory where the have been created. All the following (subprocess.Popen, os.system, os.chdir) can do what I want from within the script (i.e. they execute stuff in the target directory) but on exit leave the Terminal at the script's own directory, not the target directory.

I'd like to avoid writing a shell script to temporary file just to achieve this, if this is at all possible anyway?

© Stack Overflow or respective owner

Related posts about python

Related posts about terminal