Skip to content

glob crash on permission denied #551

Closed as not planned
Closed as not planned
@mkrugly

Description

@mkrugly
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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions