Surprising difference (bug?) between traceback and inspect

Gary Bishop gb at cs.unc.edu
Tue Jun 10 16:26:15 EDT 2003


Gary Bishop <gb at cs.unc.edu> wrote:
> The following short script illustrates...

Doh! I forgot to include the code. Here it is.

import inspect, traceback, os

def foo():
  fee()

def fee():
  print 'traceback says', traceback.extract_stack()
  print
  print 'inspect says', inspect.getouterframes(inspect.currentframe())

print 'in current directory'

foo() # both include filename

print
print 'in another directory'

os.chdir('..')

foo() # only traceback has filename





More information about the Python-list mailing list