Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#37 FancyTraceback fails if source missing

closed
MiscUtils (2)
5
2003-01-15
2002-11-23
Stuart Donaldson
No

The Fancy Traceback display can fail to work if the
source files of all files in the traceback do not exist.

This can be the case if the .py files have since been
removed, or if the .py files are not in the same path
as the .pyc are imported.

In my scenario, python is installed from an rpm, the
rpm pre-compiles the .py files in the library into .pyc
files, however it does all of this in a temporary
directory which no longer exists in my installed
system. The .pyc files claim their source file is
actually in that temporary directory. So if I look at
the module ihooks, I see its source file does not
exist, even though it is in the same directory as
ihooks.pyc.

The problem appears to be that MiscUtils/inspect.py
getsourcefile() tries to find the file on the sys.path.
However if the filename does not exist on that path,
it does not return anything, which results in cgitb.py
failing when it tries to interpret None as a string.

This patch simply adds a 'return filename' at the end
of inspect.py:getsourcefile() so it will not return None.

Discussion

  • Patch to MiscUtils/inspect.py, fixes FancyTraceback when a source file is missing.

     
    Attachments
    • labels: --> MiscUtils
     
    • assigned_to: nobody --> stuartd
     
  • Logged In: YES
    user_id=326269

    This patch is being worked on by the developer listed in the
    Assigned field. A resolution should be forthcoming.

    If you have any questions or comments on this item, please
    contact the developer.

     
    • status: open --> closed
     
  • Logged In: YES
    user_id=326269

    Resolved and committed to CVS.