Getting "current" module file ?

Olivier DECKMYN olivier.deckmyn at mail.dotcom.fr
Sat Feb 10 20:03:54 CET 2001


Hi all,

I am looking for a magic function that would tell me where is stored the
file that is currently running.
A good example is better that thousands of words :

here is /home/olivier/python/test1.py :
"""
import string
...

print "The current module test1 is stored in", magic_get_location()
"""

would get :
The current module test1 is stored in /home/olivier/python/test1.py

Thanx for your support.

ps : Python is real nice piece of code...








More information about the Python-list mailing list