How can module determine its own path?

AK Eric warpcat at
Fri Oct 30 20:30:44 CET 2009

> > How can a module determine the path of the file that defines it?
> > (Note that this is, in the general case, different from sys.argv[0].)
> __file__


import inspect
print inspect.getsourcefile(lambda:None)

More information about the Python-list mailing list