ReportLab and Django Examples

Mike Hostetler <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CAE1_9RWD62EE-BwagPugm6MNokL_FB73CrM38LX1CAXSm2vgwg@mail.gmail.com>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.