On Mon, Nov 16, 2009 at 6:18 PM, rantingrick <rantingr...@gmail.com> wrote: > 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:\\echo.py C:\\New Folder\\text.txt' > > inside my script i get the following result from sys.argv > > ['C:\\Python26\\Python.exe', 'C:\\echo.py', 'C:\\New', 'Folder\ > \text.txt'] > > So i've got a few options > 1. have people replace every space in all file paths system wide > (sucks) > 2. Create a custom parser, join the argv list, parse it...(maybe) > 3. please tell me there is an option 3? (hopefully) > -- > http://mail.python.org/mailman/listinfo/python-list >
The same thing you have to do with every command line program - wrap it in quotes. C:\\Python26\\python.exe C:\\echo.py "C:\\New Folder\\text.txt" -- http://mail.python.org/mailman/listinfo/python-list