execfile('bla.py'), can bla.py know its full path

David Porter jcm at bigskytel.com
Fri Feb 2 08:36:55 EST 2001

* Harald Kirsch <kirschh at lionbioscience.com>:

> When a script is called by execfile, can it find out the full absolute
> path name by which it was called?

You could tell it by passing a variable to it containing the value:

execfile('/home/dap/bla.py', {'path': '/home/dap/bla.py'})


More information about the Python-list mailing list