Fixes entry point loading compatibility
Handles backward compatibility for entry point loading by catching AttributeError and applying an alternative method for fetching downloaders in `pix360downloader`.
This commit is contained in:
parent
421587c695
commit
0520b40095
1 changed files with 16 additions and 5 deletions
|
@ -57,10 +57,21 @@ class Loader:
|
|||
|
||||
downloaders = []
|
||||
|
||||
try:
|
||||
for entry_point in importlib.metadata.entry_points().get("pix360downloader", []):
|
||||
try:
|
||||
downloaders.append(entry_point.load())
|
||||
except Exception as e:
|
||||
print(f"Something went wrong trying to import {entry_point}: {e}")
|
||||
|
||||
except AttributeError:
|
||||
for entry_point in importlib.metadata.entry_points().select(
|
||||
group="pix360downloader"
|
||||
):
|
||||
try:
|
||||
downloaders.append(entry_point.load())
|
||||
except Exception as e:
|
||||
print(f"Something went wrong trying to import {entry_point}: {e}"
|
||||
)
|
||||
|
||||
return downloaders
|
Loading…
Reference in a new issue