diff --git a/engine/watcher.py b/engine/watcher.py index 5d8afc6..2fa38b3 100644 --- a/engine/watcher.py +++ b/engine/watcher.py @@ -31,8 +31,12 @@ from engine.start import PATHS def fast_scandir(dir): """ Get all subdirectories recursively. - https://stackoverflow.com/questions/973473/getting-a-list-of-all-subdirectories-in-the-current-directory""" - subfolders= [f.path for f in os.scandir(dir) if f.is_dir()] + https://stackoverflow.com/questions/973473/getting-a-list-of-all-subdirectories-in-the-current-directory""" + try: + subfolders= [f.path for f in os.scandir(dir) if f.is_dir()] + except PermissionError: + subfolders = [] + for dir in list(subfolders): subfolders.extend(fast_scandir(dir)) return subfolders