diff --git a/CHANGELOG b/CHANGELOG index f526aee..bfaf585 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/mpl_data_cast/gui/widget_tree.py b/mpl_data_cast/gui/widget_tree.py index cf7bf8b..fe56aec 100644 --- a/mpl_data_cast/gui/widget_tree.py +++ b/mpl_data_cast/gui/widget_tree.py @@ -1,4 +1,5 @@ from importlib import resources +import logging import pathlib import time import threading @@ -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): @@ -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