On Nov 28, 1:46 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > Girish wrote: > > Is ter any way to identify the file name and the path in which the > > function is called. > > > for example: if the function definition is in the file c:\script1.py > > and if I call this function in a script: c:\script2.py than in the > > function definition part(script1.py) some how I need to know that its > > called in c:\script2.py. > > You can inspect the stack: > > import sys > import inspect > > def some_func(): > print inspect.getfile(sys._getframe(1)) > > Peter
Thanks a lot Peter. -- http://mail.python.org/mailman/listinfo/python-list