os.system doesn't work in Python
Question: I'm working on windows vista, but I'm running python from DOS command. I have
this simple python program. (It's actually one py file named test.py)

    
    
    import os
    os.system('cd ..')
    

When I execute "python test.py" from a Dos command, it doesn't work. For
example, if the prompt Dos Command before execution was this:

    
    
    C:\Directory>
    

After execution, must be this:

    
    
    C:\>
    

Help Plz.


Answer: First, you generally don't want to use `os.system` \- take a look at the
[subprocess module](http://docs.python.org/library/subprocess.html) instead.
But, that won't solve your immediate problem (just some you might have down
the track) - the actual reason `cd` won't work is because it changes the
working directory of the _subprocess_ , and doesn't affect the process Python
is running in - to do that, use
[`os.chdir`](http://docs.python.org/library/subprocess.html).

