location of a module's directory
Dave Berkeley
dave at rotwang.freeserve.co.uk
Fri Apr 5 06:20:34 EST 2002
Is there a way to discover where a module was loaded from?
I want to include a text configuration file with a .dll, and place them in
the same directory. If the module knows where it was loaded from it will be
able to find the config file.
If you do (Python 2.1.1)
>import sys
>print sys.modules
you can get a dictionary of loaded modules, and a description, which
includes the path the module was loaded from. However, I can find no way of
accessing this information programmatically.
Thanks
Dave Berkeley
More information about the Python-list
mailing list