Skip to content

Commit 37b7865

Browse files
committed
handle exception
1 parent 127086d commit 37b7865

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

BlocksScreen/devices/storage/udisks2.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -570,8 +570,12 @@ def _cleanup_legacy_dir(self) -> None:
570570
"""Removes legacy directory that contained symlinks
571571
for all mounted USB devices on the machine
572572
"""
573-
legacy_dir = self.gcodes_path.joinpath("USB")
574-
if legacy_dir.is_dir() and not (
575-
legacy_dir.is_symlink() or legacy_dir.is_file()
576-
):
577-
shutil.rmtree(legacy_dir)
573+
try:
574+
legacy_dir = self.gcodes_path.joinpath("USB")
575+
if legacy_dir.is_dir() and not (
576+
legacy_dir.is_symlink() or legacy_dir.is_file()
577+
):
578+
shutil.rmtree(legacy_dir)
579+
except Exception:
580+
logging.debug("Failed to remove legacy dir")
581+
return

0 commit comments

Comments
 (0)