try:
createDir = not stat.S_ISDIR(os.lstat(p).st_mode)
- except:
+ except OSError:
createDir = True
if createDir:
except OSError, e:
if e.errno != errno.ENOENT and e.errno != errno.EISDIR:
raise
+ try:
+ os.removedirs(os.path.dirname(path))
+ except OSError:
+ pass
def uniquePath(path, branch):
def fileExists(path):