[reportlab-users] ReportLab and Django Examples

Mike Hostetler mike at squarepegsystems.com
Mon Nov 26 14:13:42 EST 2018


Hi,

I'm new(ish) to RML but not reportlab and Django. I'm following the code
snippet for Django on the latest rlextras:

   buf = io.StringIO()
   buf = rml2pdf.go(rml,outputFileName=buf)
   buf.reset()

But I get the following exception:

 File "/Users/mikeh/Projects/asdf/app/reporting/services.py", line 48, in
generate_fto_project
    buf = rml2pdf.go(rml,outputFileName=buf)
  File "rlextra-3.5.11/src/rlextra/rml2pdf/rml2pdf.py", line 6391, in go
  File "rlextra-3.5.11/src/rlextra/rml2pdf/rml2pdf.py", line 6165, in
_checkDone
  File
"/Users/mikeh/.pyenv/versions/asdf/lib/python3.6/site-packages/reportlab/pdfgen/canvas.py",
line 1240, in save
    self._doc.SaveToFile(self._filename, self)
  File
"/Users/mikeh/.pyenv/versions/asdf/lib/python3.6/site-packages/reportlab/pdfbase/pdfdoc.py",
line 218, in SaveToFile
    f.write(data)
TypeError: string argument expected, got 'bytes'

The API docs say that I can send a StringIO in, but that doesn't seem to be
the case.

Ideas?

-- 
Mike Hostetler
SquarePeg Systems
http://www.squarepegsystems.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20181126/592639c3/attachment.html>


More information about the reportlab-users mailing list