This seems to work in my setup (2.0b2, Win98): import sys try: raise RuntimeError except: x=sys.exc_info()[2] print x.tb_frame.f_code.co_filename Placing this in alongfilename.py and running python alongfilename.py results in the expected output: alongfilename.py Alex