[reportlab-users] Another obscure error, this one regarding PDFPageLabel

Tim Roberts timr at probo.com
Fri May 15 19:31:23 EDT 2015


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
>     self.labels.sort()
> 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.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20150515/067fd0ca/attachment.html>


More information about the reportlab-users mailing list