Skip to content

Commit 630eb24

Browse files
committed
mv: remove misleading FileNotFoundError
1 parent 27f65e6 commit 630eb24

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

library/utils/shell_utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,15 @@ def rename_move_file(src, dst, simulate=False):
1515
else:
1616
try:
1717
return shutil.move(src, dst)
18-
except FileNotFoundError:
19-
log.error("FileNotFoundError. %s", src)
2018
except PermissionError:
2119
log.warning("PermissionError. Could not move %s into %s", src, os.path.dirname(dst))
2220
# raise
2321
except OSError as excinfo:
24-
if excinfo.errno == errno.ENOENT: # no parent folder
22+
if excinfo.errno == errno.ENOENT: # no parent folder, FileNotFoundError
2523
parent = os.path.dirname(dst)
2624
if not parent or not os.path.exists(src):
27-
raise
25+
log.error("FileNotFoundError. %s", src)
26+
return
2827
os.makedirs(parent, exist_ok=True)
2928
return rename_move_file(src, dst, simulate)
3029

0 commit comments

Comments
 (0)