Handle access errors scanning directories

Trying to read a directory that is visible but not accessible, or a
symlink to a file in a directory that is not accessible will raise a
PermissionError. Output these and then continue.

If os.scandir() raises an exception then the finally block accesses
"scanner" before it is assigned, raising an UnboundLocalError.
This commit is contained in:
Simon Arlott 2020-06-21 10:13:55 +01:00
parent fc9c2b4a1d
commit 88a72ea14d
No known key found for this signature in database
GPG key ID: DF001BFD83E75990
2 changed files with 21 additions and 8 deletions

View file

@ -0,0 +1 @@
Handle access errors scanning directories when importing files