Re: Another obscure error, this one regarding PDFPageLabel
Tim Roberts <[email protected]>
| Newsgroups | gmane.comp.python.reportlab.user |
|---|---|
| Organization | Providenza & Boekelheide, Inc. |
| Message-ID | <[email protected]> |
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, [email protected]
Providenza & Boekelheide, Inc.