How can I find the path for a Python module without importing it?
It seems like it should be obvious but I can't find a function to do this. (Yes I double-checked the docs for imp
).
Note: I can't import the module.
Also this is a python2 specific issue, so I can't use importlib.find_loader
.
update per comment:
In python3 this can be done with importlib.find_loader
which returns an object with a path
property, which works for packages and files (unlike imp.find_module
).