[reportlab-users] Another obscure error, this one regarding PDFPageLabel
v+python at g.nevcal.com
Fri May 15 20:37:58 EDT 2015
On 5/15/2015 4:31 PM, Tim Roberts wrote:
> Glenn Linderman wrote:
>> Using PDFPageLabel, I accidentally defined two labels for the same
>> page. This resulted in the following stack trace...
>> File "C:\Python34\lib\site-packages\reportlab\pdfbase\pdfdoc.py",
>> line 1185, in format
>> TypeError: unorderable types: PDFPageLabel() < PDFPageLabel()
>> The following adjustment to pdfdoc.py would improve the message.
>> Maybe the real problem is sorting by the whole tuple, instead of just
>> using the first element as the sort key, which seems to be what is
>> expected to happen.
>> + raise TypeError("unorderable types PDFPageLabel. Likely
>> duplicate labels for same page number.")
> It's a little arrogant of you to assume that the cause of the
> exception in your case happens to be the "likely" cause of the
> exception in the general case. It could be a genuine data type
> problem. In general, I'd rather let the native exception show through.
What you call arrogance is a result of reading the code, adding debug
statements, learning how it worked, and analyzing, yes, only my,
problem. However, as you can see from the stack trace you left in the
quote, the message I suggested subsumes the original message, thus
permitting the original message to be considered in the unlikely event
that there are no duplicate page numbers in the page label list. But if
there are no duplicate page numbers, there would be no attempt to
compare PDFPageLabel objects, which are the second item in the tuple
being sorted, page number being first.
If you can come up with _any_ other scenario that could produce this
stack trace, I'd be extremely interested. If not, I'll consider it a
little arrogant of you make accusations of arrogance.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the reportlab-users