Command line arguments??

rantingrick rantingrick at
Tue Nov 17 00:18:23 CET 2009

I am currently having "fun" with command line arguments in a windows
environment. If i get a path that has spaces anywhere in it my script
gets the wrong arguments from sys.argv. You guy's probably know what i
am talking about. Heres and example.

'C:\\Python26\\Python.exe C:\\ C:\\New Folder\\text.txt'

inside my script i get the following result from sys.argv

['C:\\Python26\\Python.exe', 'C:\\', 'C:\\New', 'Folder\

So i've got a few options
  1. have people replace every space in all file paths system wide
  2. Create a custom parser, join the argv list, parse it...(maybe)
  3. please tell me there is an option 3? (hopefully)

More information about the Python-list mailing list