module path?

akonsu akonsu at gmail.com
Tue Sep 29 01:41:36 CEST 2009


hello,

is there a way to determine the file location of a loaded module?
assuming it is not built in.

import settings
print settings

produces: <module 'settings' from 'd:\ko\mysite\settings.pyc'>

i would like to get to this path somehow other than by parsing the
string representation of the module. is there a property on
types.ModuleType? i could not find anything...

thanks
konstantin



More information about the Python-list mailing list