How can module determine its own path?

kj no.email at please.post
Fri Oct 30 21:35:25 CET 2009


In <7e456639-9dbb-41ba-ae36-042a034fa6a8 at y32g2000prd.googlegroups.com> AK Eric <warpcat at sbcglobal.net> writes:


>> > 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)

Thank you both!

kynn



More information about the Python-list mailing list