I have the statement
fn = sys.argv[1]
catching the filename at the command line when the user starts my program. The problem comes when a user uses a path with a space in it such as; 'C:\Documents and Settings\user\My Documents\'.
The argument parser sees ''C:\Documents' as the first paramenter, and 'and Settings\user\My ' as another parameter.
I am trying to get the program to run in the form:
myprogram.py inputfile -1 -2 (two switches). It works as long as the filename and or path have no gaps in them.
I'm using
sys.argv.count("-1")>0:
to parse the switches so I cant surround the filename and path with quoted, because I'm not getting the whole file handed to me.
Any ideas?