[reportlab-users] XML Parser Error in Paragraph.py
Robin Becker
reportlab-users@reportlab.com
Tue, 7 Jan 2003 19:11:39 +0000
In article <000401c2b671$65bc63c0$5b01a8c0@Dalbar.com>, Marc Stober
<MStober@dalbar.com> writes
>
>I received the following error using ReportLab:
> File "C:\PYTHON22\reportlab\platypus\paragraph.py", line 365, in _setup
> raise "xml parser error (%s) in paragraph beginning\n'%s'"\
>TypeError: exceptions must be strings, classes, or instances, not unicode
>
>It seems that the underlying error is not being shown because the XML doc is
>in Unicode. Would it be possible to change the lines in paragraph.py to
>include str() as follows:
> raise str("xml parser error (%s) in paragraph
>beginning\n'%s'" \
> % (_parser.errors[0],text[:min(30,len(text))]) )
>This correctly gives the underlying error on my system (Python 2.2).
>
>Thanks!
>
>Marc Stober
>mstober@dalbar.com
>
ouch :) I think this is going to be more and more of a problem as people
use unicode more and more. The difficulty here is that we're using an
old style error, probably from the beginning of time.
I think we probably ought to have a reportlabError class and do all of
these properly.
What's strange here is that I assume the problem comes because %s isn't
converting the argument to a string.
--
Robin Becker