[Tutor] Referer file from import
Isr Gish
isrgish at fastem.com
Fri Jan 14 17:42:32 CET 2005
Chad Crabtree wrote:
>Is there a way to know what the path of the file is that imported a
>module? I've tried __file__ and playing with globals() but I can't
>seem
>to crack this.
>
There most be a way because the Tracebacks give us this info.
You want to take a look at the 'inspect' module. I belive looking at the source of the traceback module may help alot.
All the best,
Isr
More information about the Tutor
mailing list