Need help dealing with spaces in NT paths.

piet at cs.uu.nl piet at cs.uu.nl
Wed Nov 17 11:56:21 CET 1999


>>>>> "T. C. Mits" <71351.356 at compuserve.com> (TCM) writes:

TCM> A simple example of the difficulty is:
>>>> os.system(r'"dir Program Files"')
TCM> Bad command or file name
TCM> 0
>>>> 


TCM> This is run at the root of C: for simplicity.


TCM> I also get:

TCM> os.popen(r'"dir Program Files"', "r")
TCM> Bad command or file name
TCM> <open file '"dir program files"', mode 'r'  at 795930>

TCM> What does that mean?

It means there is no program with the name: dir program files
You should use:

os.system(r'dir "Program Files"')
os.popen(r'dir "Program Files"', "r")
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: Piet.van.Oostrum at gironet.nl




More information about the Python-list mailing list