Skip to content

Commit

Permalink
[plugins] Handle PermissionError (#9229)
Browse files Browse the repository at this point in the history
Authored by: syntaxsurge, pukkandan
  • Loading branch information
syntaxsurge committed Feb 20, 2024
1 parent 104a7b5 commit 9a8afad
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions yt_dlp/plugins.py
Expand Up @@ -86,11 +86,14 @@ def _get_package_paths(*root_paths, containing_folder='plugins'):
parts = Path(*fullname.split('.'))
for path in orderedSet(candidate_locations, lazy=True):
candidate = path / parts
if candidate.is_dir():
yield candidate
elif path.suffix in ('.zip', '.egg', '.whl') and path.is_file():
if parts in dirs_in_zip(path):
try:
if candidate.is_dir():
yield candidate
elif path.suffix in ('.zip', '.egg', '.whl') and path.is_file():
if parts in dirs_in_zip(path):
yield candidate
except PermissionError as e:
write_string(f'Permission error while accessing modules in "{e.filename}"\n')

def find_spec(self, fullname, path=None, target=None):
if fullname not in self.packages:
Expand Down

0 comments on commit 9a8afad

Please sign in to comment.