Commit 41e4d5b5 authored by Dimitris Aragiorgis's avatar Dimitris Aragiorgis

Fix makedirs() usage

In we run:

  os.makedirs("dir1")
  os.makedirs("dir1")

we get OSError: [Errno 17] File exists: 'dir1'

Contrary to that if we run:

  os.makedirs("dir1")
  os.makedirs("dir1/dir2")

it succeeds.

Therefore we must check if our target directory exists before
running makedirs.
Signed-off-by: default avatarDimitris Aragiorgis <dimitris.aragiorgis@gmail.com>
parent ffc3cf07
......@@ -1381,7 +1381,7 @@ class file_download(_PithosContainer):
progress_bar = None
try:
for rpath, output_file in self._src_dst(local_path):
if not rpath:
if not rpath and not path.exists(output_file):
self.error('Create local directory %s' % output_file)
makedirs(output_file)
continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment