Function to retrieve running script

Alex Martelli aleax at mail.comcast.net
Sat Dec 3 21:35:15 EST 2005


Harlin Seritt <harlinseritt at yahoo.com> wrote:

> Is there a function that allows one to get the name of the same script
> running returned as a string?

Something like:

import sys
def f():
  return sys.modules['__main__'].__file__

might help.


Alex



More information about the Python-list mailing list