pyfilesystem2 icon indicating copy to clipboard operation
pyfilesystem2 copied to clipboard

glob crash on permission denied

Open mkrugly opened this issue 3 years ago • 0 comments

from fs.osfs import OSFS
loc = OSFS('/')
for i in loc.glob('/my_glob/pattern/*'):
   print(i.path)

osfs.py", line 489, in _scandir
    scandir_iter = scandir(sys_path)
PermissionError: [WinError 5] Access is denied:

There seems to be no way to ignore errors in case of fs.glob in oppose to the fs.walk which has an ignore_errors attribute. This reduces the usability of fs.glob comparing to the python's glob module (which ignores permission denied error).

Would it be possible to introduce the ignore_errors flag, just like in the fs.walk or is there a good reason not to?

mkrugly avatar Sep 14 '22 22:09 mkrugly