Skip to content

Commit

Permalink
fix: handle stat errors when scanning directory tree
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Jun 26, 2024
1 parent 9b0c74d commit 1d12f2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.7.0
- fix: handle copy errors (retry first, fail better)
- fix: handle stat errors when scanning directory tree
- setup: bump dclab from 0.58.2 to 0.60.0
0.6.4
- setup: compile PyInstaller bootloader for every release
Expand Down
10 changes: 9 additions & 1 deletion mpl_data_cast/gui/widget_tree.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from importlib import resources
import logging
import pathlib
import time
import threading
Expand All @@ -10,6 +11,9 @@
from ..util import is_dir_writable


logger = logging.getLogger(__name__)


class TreeObjectCounter(threading.Thread):
"""Thread running in the background, counting objects and their size"""
def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -79,7 +83,11 @@ def run(self):
# Windows might encounter PermissionError.
pass
else:
if pp.is_dir() or pp.name in ignored_files:
try:
if pp.is_dir() or pp.name in ignored_files:
continue
except BaseException:
logger.warning(f"Could not stat {pp}")
continue
with self.lock:
# check before incrementing
Expand Down

0 comments on commit 1d12f2f

Please sign in to comment.