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

Hartmut Goebel h.goebel at
Sat Jan 3 20:15:17 CET 2004


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.

Hartmut Goebel

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

More information about the Python-list mailing list