How can module determine its own path?

Stef Mientki stef.mientki at gmail.com
Fri Oct 30 19:40:59 EDT 2009


Robert Kern wrote:
> On 2009-10-30 12:19 PM, kj wrote:
>> 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__
>
but for modules launched with execfile, __file__ doesn't exists.

cheers,
Stef



More information about the Python-list mailing list