robert.kern at gmail.com
Sat Oct 10 02:38:35 CEST 2009
On 2009-10-09 19:08 PM, David Robinow wrote:
> On Fri, Oct 9, 2009 at 5:02 PM, Ethan Furman<ethan at stoneleaf.us> wrote:
>> A puzzlement:
>> I used easy_install the other day to get xlutils on my system. It
>> automatically installed xlrd and xlwt as well. This is cool. What's not so
>> cool are my tracebacks. E.g.
>> Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)]
>> on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>> --> import xlwt
>> --> xlwt.__name__
>> --> xlwt.__file__
>> --> xlwt.Workbook().save('non-file')
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in<module>
>> line 634, in save
>> line 615, in get_biff_data
>> IndexError: list index out of range
>> Anyone know why that is?
> You can't save a workbook with no worksheets.
> W = xlwt.Workbook()
I think he's asking why the exception message does not have the source lines in
the traceback, like exceptions inside regularly installed packages.
The answer is that once files are zipped, like the egg that you have installed,
the traceback printing function in C does not know how to get at the source
files any more. The traceback printing function in the pure Python traceback
module does, though. Try this:
>>> import sys
>>> import traceback
>>> sys.excepthook = traceback.print_exception
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-list