module path?

akonsu akonsu at gmail.com
Mon Sep 28 19:41:36 EDT 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