0

Hi,

I started Python command prompt and entered this:

import distutils.dir_util as du

du.mkpath( "c:/foo/bar" ) #assume dir 'foo' doesn't exist

This works fine and it creates the path 'foo/bar'.

Now, go to file explorer and delete the dir 'foo' and go to the Python prompt and issue the same cmd.

du.mkpath( "c:/foo/bar" )
Now, it just returns []

OTOH, if you try
du.mkpath( "c:/foo/bar2" )
it craps with an exception:

Traceback (most recent call last):
File "<pyshell#17>", line 1, in <module>
du.mkpath( "c:/foo/bar2")
File "C:\Python26\lib\distutils\dir_util.py", line 80, in mkpath
"could not create '%s': %s" % (head, exc[-1])
DistutilsFileError: could not create 'c:\foo\bar2': The system cannot find the path specified


Same thing happens on Linux too.
Any help appreciated - as to my incorrect usage or anything else.
Thanks

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by Stefano Mtangoo
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.