We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 48f9c27 commit c7ba84aCopy full SHA for c7ba84a
can/interfaces/__init__.py
@@ -32,14 +32,16 @@
32
try:
33
from importlib.metadata import entry_points
34
35
- entry = entry_points()
36
- if "can.interface" in entry:
37
- BACKENDS.update(
38
- {
39
- interface.name: tuple(interface.value.split(":"))
40
- for interface in entry["can.interface"]
41
- }
42
- )
+ try:
+ entries = entry_points(group="can.interface")
+ except TypeError:
+ # Fallback for Python <3.10
+ # See https://docs.python.org/3/library/importlib.metadata.html#entry-points, "Compatibility Note"
+ entries = entry_points().get("can.interface", [])
+
+ BACKENDS.update(
43
+ {interface.name: tuple(interface.value.split(":")) for interface in entries}
44
+ )
45
except ImportError:
46
from pkg_resources import iter_entry_points
47
0 commit comments