Fredrik Lundh wrote: > if you're wrapping some cmd.exe command in an internal API, it's usually > easier to call "os.path.normpath" the last thing you do before you call > "os.system", than to get all the backslashes right in your code. > > also see: > > http://www.effbot.org/pyfaq/why-can-t-raw-strings-r-strings-end-with-a-backslash.htm
and as just I pointed out in a comment on that page, getting the slashes right doesn't help you with spaces in filenames. to write reliable code for os.system, you want something like: import os.path import subprocess def mysystem(command, *files): files = map(os.path.normpath, files) files = subprocess.list2cmdline(files) return os.system(command + " " + files) mysystem("more", "/program files/subversion/readme.txt") but then you might as well use subprocess.call, of course. </F> -- http://mail.python.org/mailman/listinfo/python-list