Modify ↓
#9421 closed enhancement (fixed)
Also show source on error page when code is packaged as egg
Reported by: | Remy Blank | Owned by: | Remy Blank |
---|---|---|---|
Priority: | high | Milestone: | 0.12 |
Component: | general | Version: | 0.12dev |
Severity: | normal | Keywords: | error |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
The traceback on the internal error page shows a snippet of the source code around the line where the exception occurred. This works well when the source files are directly available, but not when they are packaged as an .egg
.
I have a patch that makes this work, and even simplifies the current code.
Attachments (0)
Change History (2)
comment:1 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:2 by , 14 years ago
Great job Remy, verified to work on my production system on Linux (build/bdist.linux-x86_64/egg/trac/...
) and on my test systems on Windows (build/bdist.win32/egg/trac/...
, 2.4.4, 2.5.4, 2.6.5 and 2.7rc1).
Note:
See TracTickets
for help on using tickets.
Patch applied in [9858], tested on Linux (with Python 2.4, 2.5 and 2.6), OS X (2.6), Windows XP (2.6), Windows Vista (2.6) and Windows 7 (2.6), with an egg generated with Linux and Windows 7.
The simplified code (using only the
linecache
module) only works reliably on Python 2.6. Prior versions return lines from the wrong file, so an explicit scan for eggs insys.path
had to be added.