Skip to content

Commit 289cc66

Browse files
Kincaid Savoiepkittenis
authored andcommitted
Switch mkdir to makedirs and surround it with a try/catch.
1 parent 16d392f commit 289cc66

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pssh/ssh_client.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,10 @@ def copy_file_to_local(self, remote_file, local_file, recurse=False):
420420
if local_file.startswith(os.path.sep):
421421
destination = os.path.sep + destination
422422
if not os.path.exists(destination):
423-
os.mkdir(destination)
423+
try:
424+
os.makedirs(destination)
425+
except OSError:
426+
logger.error("Unable to create local directory structure.")
424427
try:
425428
sftp.get(remote_file, local_file)
426429
except Exception, error:

0 commit comments

Comments
 (0)