Simple way to get the full path of a running script?

Hartmut Goebel h.goebel at crazy-compilers.com
Sat Jan 3 20:15:17 CET 2004


Hi,

Wolfgang Lipp schrieb:

> import inspect
> print inspect.getsourcefile( lambda:None )

Nice idea!

Enhancement: when using inspect.getfile() the snippet will work even for 
module without sourcefile, too.

-- 
Regards
Hartmut Goebel

| Hartmut Goebel               | We build the crazy compilers |
| h.goebel at crazy-compilers.com | Compiler Manufacturer        |




More information about the Python-list mailing list