I'm having difficulties parsing filepaths sent as arguments:

If I type:

os.path.normpath('D:\Data2\090925')

I get

'D:\\Data2\x0090925'

0bviously the \0 in the folder name is upsetting the formatting. I can correct it with the following:

os.path.normpath(r'D:\Data2\090925')

which gives

'D:\\Data2\\090925'

My problem is, how do I achieve the same result with sys.argv, namely: os.path.normpath(sys.argv[1]) I can't find a way for feeding sys.argv in a raw mode into os.path.normpath() to avoid issues with folders starting with zero!

Ok, I solved my problem by not using os.path.normpath(). If I use it before calling os.path.split(), the lowest folder will be assumed to be a file, because the trailing \ has been removed