function which knows who has called it.
news at dorb.com
Mon Aug 16 20:52:54 EDT 1999
You can get the callers name from this also.
But that's up to you.
Get the directory of the module running at "howfarBack "
in the stack frames
This value is compiled into the .pyc file
This can be a problem.
Name will change depending on where python was run from
when the pyc file was created
Unix can store a relative path
Windows stores an absolute path
f = sys.exc_info().tb_frame
for i in range(howFarBack):
f = f.f_back
t = f.f_code
fname = t.co_filename
p = string.split(fname, os.sep)
fname = string.join(p[:-1], os.sep)
Phil Hunt <philh at vision25.demon.co.uk> wrote in message
news:934841569snz at vision25.demon.co.uk...
> Is if possible in Python to have a function that prints the name
> of the function that called it. (I'm thinking of using this in
> some debugging code I want to write).
> Phil Hunt....philh at vision25.demon.co.uk
More information about the Python-list