On 22/02/2015 22:06, jkuplin...@gmail.com wrote:
Hi,

I thought this would be easy:


for subprocess import call call (['cd', r'C:\apps'], shell = True)


It doesn't work -- tried with/without prefix r, escaped backslashes,
triple quotes, str(), .. nothing seems to work (it doesn't complain,
but it doesn't change directories either) -- what am I doing wrong?

Two things:

1) All you're doing is running up a subprocess, changing directory *within it* and then closing it. (Altho' good job spotting that you'd need shell=True if you did indeed want to do what you're doing here).

2) Use os.chdir: that's what it's there for

TJG
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to