Surprising difference (bug?) between traceback and inspect

Gary Bishop gb at cs.unc.edu
Tue Jun 10 16:49:30 EDT 2003


Gary Bishop <gb at cs.unc.edu> wrote: Some stuff about a bug in inspect.

On further reflection, I think this is a bug in Python. Module
inspect's getsourcefile wants the file to exist because later
inspect.findsource will try to read from the file.

It seems to me the problem is with the filename that Python keeps for
modules imported from the current directory. They appear to me to be
just the relative pathname but they should be absolute so
introspection has a chance of finding the thing that actually got
imported. It seems to me one could get hopelessly confused by a
program that used os.chdir to change to a directory with identically
named modules...

gb




More information about the Python-list mailing list