Find the location of a loaded module
Christian Heimes
lists at cheimes.de
Fri Feb 20 13:39:51 EST 2009
Aaron Scott schrieb:
> I'm running into a problem that's rapidly reaching keyboard-smashing
> levels. I'm trying to import a module into Python, but it seems like
> Python is almost randomly loading the module from an entirely
> different directory, one that shouldn't be in the module search path.
>
> When I tell Python to load a module, is there a way to tell which
> directory the module was loaded from?
All except builtin modules have an attribute __file__ that points to the
file.
Christian
More information about the Python-list
mailing list