closed: module file

Imbaud Pierre pierre at
Sat Jan 13 10:58:04 CET 2007

Imbaud Pierre a écrit :
> I am willing to retrieve the file an imported module came from;
> module.__file__, or inspect.getfile(module) only gives me the
> relative file name. How do I determine the path?
> Its obviously possible from python: ipython displays the information
> (interactively: *module?*).
> Python 2.4 on Suse 9.3 (clueless, I guess)
Apologies: module.__file__, or inspect.getfile(module) only *gave* me
the relative file name, because the module was found in the current
directory! Changing the current directory, and having the module be
found thru the path, changed the returned path to an absolute
Hence the simplest form at hand was used. Thank you, python!

More information about the Python-list mailing list