From 3fd748cc5a8e53007f9c9570d6e4e06873a4a2f0 Mon Sep 17 00:00:00 2001 From: spl0k Date: Sat, 20 Jan 2018 21:44:20 +0100 Subject: [PATCH] Scanner: handle permission errors --- supysonic/scanner.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/supysonic/scanner.py b/supysonic/scanner.py index aa1c6c3..e3cef28 100644 --- a/supysonic/scanner.py +++ b/supysonic/scanner.py @@ -69,7 +69,13 @@ class Scanner: scanned = 0 while to_scan: path = to_scan.pop() - for f in os.listdir(path): + + try: + entries = os.listdir(path) + except OSError: + continue + + for f in entries: try: # test for badly encoded filenames f.encode('utf-8') except UnicodeError: