mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-26 02:55:17 +00:00
[plugins] Handle PermissionError
(#9229)
Authored by: syntaxsurge, pukkandan
This commit is contained in:
parent
104a7b5a46
commit
9a8afadd17
1 changed files with 7 additions and 4 deletions
|
@ -86,11 +86,14 @@ def _get_package_paths(*root_paths, containing_folder='plugins'):
|
||||||
parts = Path(*fullname.split('.'))
|
parts = Path(*fullname.split('.'))
|
||||||
for path in orderedSet(candidate_locations, lazy=True):
|
for path in orderedSet(candidate_locations, lazy=True):
|
||||||
candidate = path / parts
|
candidate = path / parts
|
||||||
|
try:
|
||||||
if candidate.is_dir():
|
if candidate.is_dir():
|
||||||
yield candidate
|
yield candidate
|
||||||
elif path.suffix in ('.zip', '.egg', '.whl') and path.is_file():
|
elif path.suffix in ('.zip', '.egg', '.whl') and path.is_file():
|
||||||
if parts in dirs_in_zip(path):
|
if parts in dirs_in_zip(path):
|
||||||
yield candidate
|
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):
|
def find_spec(self, fullname, path=None, target=None):
|
||||||
if fullname not in self.packages:
|
if fullname not in self.packages:
|
||||||
|
|
Loading…
Reference in a new issue