Jean-Marc Ranger wrote:
> With Python 2.3.3 for Windows, I understand why
> os.makedirs("C:\SomeDirectoryThatDontExist\.\Anoth erDirectory")
> fails throwing an exception saying "OSError: [Errno 17] File exists" -
> the period is like a request to create the same directory a second time.
>
> But is this the expected behavior ? I personaly would prefer to see
> this operation succeed - and don't like the idea of writing a
> workaround
It feels like a bug to me. I would expect os.makedirs to run its argument
through os.path.abspath first. But, you can easily do that yourself:
>>> os.path.abspath("C:\\SomeDirectory\\.\\AnotherDire ctory")
'C:\\SomeDirectory\\AnotherDirectory'
>>>
Also, you got very lucky with your backslashes:
>>> "C:\SomeDirectory\.\AnotherDirectory"
'C:\\SomeDirectory\\.\\AnotherDirectory'
>>> "C:\someDirectory\.\anotherDirectory"
'C:\\someDirectory\\.\x07notherDirectory'
>>>
-Mike