We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3640987 commit 387d11cCopy full SHA for 387d11c
1 file changed
pgfutils.py
@@ -48,10 +48,16 @@ def imported(self) -> set[Path]:
48
paths = set()
49
50
for mod in sys.modules.values():
51
- if mod.__spec__ is None or mod.__spec__.origin is None:
+ # Find the spec used to load the module and from that the origin. If not
52
+ # given, skip this module.
53
+ spec = getattr(mod, "__spec__", None)
54
+ if spec is None:
55
+ continue
56
+ origin = getattr(spec, "origin", None)
57
+ if origin is None:
58
continue
59
- path = Path(mod.__spec__.origin)
60
+ path = Path(origin)
61
if path.exists() and path.is_file():
62
paths.add(path.resolve())
63
0 commit comments