Paragraph on reportlab's canvas says it doesn't have attribute 'decode'

30 Views Asked by At

I'm trying to add a multiline text in reportlab canvas by using reportlab.platypus.Paragraph like this:

desc = Paragraph("""Hi everyone""")
desc.wrapOn(c, width, height)
desc.drawOn(c, x, y)

When I run the script an AttributeError pops up, saying that Paragraph has no attribute decode.

I'm not sure where's that error coming from (or how to solve it).

*I'm using Python 3.10. Not sure if that's relevant to the question.

1

There are 1 best solutions below

0
Rusca8 On

Oh wait, sorry. I forgot I had a regular drawString afterwards, pulling from the same "desc" object (which used to be a regular string), and apparently that drawString is the thing that broke (not the code drawing the paragraph itself).

Just... make sure you're not trying to draw a Paragraph with drawString.