I got a stupid problem; on my WinXP-box I want to scan the filesystem
and enter a path to scan like this :
path_to_scan = 'd:\test_images '
This is used in a larger context and joined like
real_path_after _scanning = os.path.join(pa th_to_scan, somepart, 'foo',
'bar', filename)
Using os.path.exists( real_path_after _scanning) returns false. The
problem is that some of the parts being joined contains escape
characters, like \. If I take the seperate parts and join them using
the interpreter, like :[color=blue][color=green][color=darkred]
>>> f = r'd:\test_image s\something\foo \bar\test.jpg'[/color][/color][/color]
it works ok and os.path.exists( f) returns True, but I cannot the that
r' in front using the os.path.join-method in my code.
I don't know if this makes any sense at all, but I'm lost. Damn those
stupid windows-paths !!
Thanks in advance,
Thomas
and enter a path to scan like this :
path_to_scan = 'd:\test_images '
This is used in a larger context and joined like
real_path_after _scanning = os.path.join(pa th_to_scan, somepart, 'foo',
'bar', filename)
Using os.path.exists( real_path_after _scanning) returns false. The
problem is that some of the parts being joined contains escape
characters, like \. If I take the seperate parts and join them using
the interpreter, like :[color=blue][color=green][color=darkred]
>>> f = r'd:\test_image s\something\foo \bar\test.jpg'[/color][/color][/color]
it works ok and os.path.exists( f) returns True, but I cannot the that
r' in front using the os.path.join-method in my code.
I don't know if this makes any sense at all, but I'm lost. Damn those
stupid windows-paths !!
Thanks in advance,
Thomas
Comment