Function to retrieve running script

2005-12-03 Thread Harlin Seritt
Is there a function that allows one to get the name of the same script
running returned as a string?

Thanks,

Harlin Seritt

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Function to retrieve running script

2005-12-03 Thread Alex Martelli
Harlin Seritt <[EMAIL PROTECTED]> 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
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Function to retrieve running script

2005-12-03 Thread Mike Meyer
"Harlin Seritt" <[EMAIL PROTECTED]> writes:
> Is there a function that allows one to get the name of the same script
> running returned as a string?

The questions a little ambiguous, but one answer might be:

import sys
myname = sys.argv[0]

  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Function to retrieve running script

2005-12-04 Thread Harlin Seritt
Thanks Mike,

that will work just as well... just disappointed in myself that i lack
the creativity to think of something that simple ;-)

thanks,

Harlin

-- 
http://mail.python.org/mailman/listinfo/python-list