os.system() and path problems

Robert Roberts robert_j_roberts at rl.gov
Mon Nov 13 07:35:36 EST 2000


I apoligize if this comes through as a re-post.  I posted last week
and as far as I can tell, my post never made it.  Hence, I try again.

Am running Python 1.5.2 on Windows NT.

I have Python code that launches a .bat file.  It has worked fine for
over a year and suddenly quit working.  I know see the same problem
when testing within the interactive interpreter.

It's most likely a problem with something they've done on our network
here, but someone might have a suggestion.

The code looks something like this.

        oldwd=os.getcwd()
        os.chdir('\\\\apsrv10\\e$\\00_rim\\Dev')
        os.system('thefile.bat')
        os.chdir(oldwd)

        # Note: I even tried...
        os.system('\\\\apsrv10\\e$\\00_rim\\Dev\\thefile.bat')

In the interactive interpreter, if I run something like...

        os.chdir('\\\\apsrv10\\e$\\00_rim\\Dev')
        os.getcwd()

... I find that the cwd is exactly what I set it to. However, if I do
a

        os.system('dir')

...and pause it in time, I find that the dir was done on 

        c:\winnt

...hence, the cwd as seen by Python versus the cwd seen by os.system()
are two different things.

Any suggestions?




More information about the Python-list mailing list