diff options
| -rw-r--r-- | pkg_resources/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index ce6053f1..6eca01dc 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -2036,9 +2036,12 @@ def find_on_path(importer, path_item, only=False): except OSError as e: # Ignore the directory if does not exist, not a directory or we # don't have permissions - if (e.errno in (errno.ENOTDIR, errno.EACCES, errno.ENOENT) + ignorable = ( + e.errno in (errno.ENOTDIR, errno.EACCES, errno.ENOENT) # Python 2 on Windows needs to be handled this way :( - or hasattr(e, "winerror") and e.winerror == 267): + or getattr(e, "winerror", None) == 267 + ) + if ignorable: return raise # scan for .egg and .egg-info in directory |
