[reportlab-users] Possible String/Unicode bug in reportlab. Where do I report it?

Chris Bergstresser chris at subtlety.com
Sun Jun 21 18:29:03 EDT 2009


On Sat, Jun 20, 2009 at 6:01 PM, Roberto
Alsina<ralsina at netmanagers.com.ar> wrote:

> On Saturday 20 June 2009 19:47:40 Chris Bergstresser wrote:

>>   I just started using ReportLab (through the rst2pdf library) and so

>> I'm not entirely sure this isn't a problem with rst2pdf, but it

>> certainly looks like a ReportLab bug.  When it tries to draw tables, I

>> get a:

>>

>> ValueError: Unknown color u'black'

>>

>>   The last line of the stack is:

>>

>> File

>> "c:\Python26\Lib\site-packages\reportlab-2.3-py2.6-win32.egg\reportlab\pdfg

>>en\textobject.py", line 98, in setStrokeColor

>>  raise ValueError('Unknown color %r' % aColor)

>>

>>   ... and a brief check of the code reveals this check above it:

>>

>>    elif type(aColor) is StringType:

>>            self.setStrokeColor(toColor(aColor))

>>

>>  obviously, this fails because aColor is Unicode.  (For that matter,

>> toColor only accepts binary strings as well). I cannot, for the life

>> of me, fathom *why*.  At any rate, the fix is trivial, depending on

>> the desired behavior--since I don't understand the rationale for

>> refusing to accept Unicode in the first place, I'm hesitant to suggest

>> a specific fix.

>

> Since I intend to keep supporting RL 2.3, could you post a simple test case in

> rst2pdf's bug tracker? Maybe it *is* rst2pdf's fault, and if it isn't I need

> to create a workaround anyway :-)


I wish it were that simple. I'm calling
rst2pdf.createpdf.RstToPdf().createPdf(doctree = doctree, output =
dest, compressed = False) directly, so I need to mock up a table call,
generate the doctree from it, and pass it on to the rst2pdf function.
Since I'm recovering from the flu and about 2 weeks behind on
something due by Tuesday, it'll have to wait a couple weeks.

-- Chris


More information about the reportlab-users mailing list