How can module determine its own path?

AK Eric warpcat at sbcglobal.net
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__

Also:

import inspect
print inspect.getsourcefile(lambda:None)



More information about the Python-list mailing list