projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixing things up
[arvados.git]
/
sdk
/
python
/
arvados
/
util.py
diff --git
a/sdk/python/arvados/util.py
b/sdk/python/arvados/util.py
index 9286795e5dc5879160244d94dccc91b95251870a..552fbbe31fad1d106a0ff41f574e0455ec8ae7e8 100644
(file)
--- a/
sdk/python/arvados/util.py
+++ b/
sdk/python/arvados/util.py
@@
-3,6
+3,7
@@
import hashlib
import os
import re
import subprocess
import os
import re
import subprocess
+import errno
def clear_tmpdir(path=None):
"""
def clear_tmpdir(path=None):
"""
@@
-225,7
+226,7
@@
def collection_extract(collection, path, files=[], decompress=True):
files_got += [outname]
if os.path.exists(os.path.join(path, stream_name, outname)):
continue
files_got += [outname]
if os.path.exists(os.path.join(path, stream_name, outname)):
continue
-
util.
mkdir_dash_p(os.path.dirname(os.path.join(path, stream_name, outname)))
+ mkdir_dash_p(os.path.dirname(os.path.join(path, stream_name, outname)))
outfile = open(os.path.join(path, stream_name, outname), 'wb')
for buf in (f.readall_decompressed() if decompress
else f.readall()):
outfile = open(os.path.join(path, stream_name, outname), 'wb')
for buf in (f.readall_decompressed() if decompress
else f.readall()):
@@
-242,13
+243,16
@@
def collection_extract(collection, path, files=[], decompress=True):
return path
def mkdir_dash_p(path):
return path
def mkdir_dash_p(path):
- if not os.path.exists(path):
- util.mkdir_dash_p(os.path.dirname(path))
+ if not os.path.isdir(path):
try:
try:
- os.mkdir(path)
- except OSError:
- if not os.path.exists(path):
- os.mkdir(path)
+ os.makedirs(path)
+ except OSError as e:
+ if e.errno == errno.EEXIST and os.path.isdir(path):
+ # It is not an error if someone else creates the
+ # directory between our exists() and makedirs() calls.
+ pass
+ else:
+ raise
def stream_extract(stream, path, files=[], decompress=True):
"""Retrieve a stream from Keep and extract it to a local
def stream_extract(stream, path, files=[], decompress=True):
"""Retrieve a stream from Keep and extract it to a local