[reportlab-users] ReportLab and Django Examples

Mike Hostetler mike at squarepegsystems.com
Mon Nov 26 14:41:53 EST 2018


I knew it waa old but that was all you had...

I'm using Python 3.6.6 and Django 2.1.3.

On Mon, Nov 26, 2018, 1:40 PM Andy Robinson <andy at reportlab.com wrote:

> Hi Mike,
>
> That snippet went up in about 2006 when we did our first Django
> project ;-)  Which version of Python are you using?
>
> - Andy
>
>
> - Andy
> On Mon, 26 Nov 2018 at 19:14, Mike Hostetler <mike at squarepegsystems.com>
> wrote:
> >
> > 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
> > _______________________________________________
> > reportlab-users mailing list
> > reportlab-users at lists2.reportlab.com
> > https://pairlist2.pair.net/mailman/listinfo/reportlab-users
>
>
>
> --
> Andy Robinson
> Managing Director, ReportLab
> Wimbletech Zone 2
> 35 Wimbledon Hill Road
> London SW19 7NB, UK
> Tel +44-20-8191-7277
> _______________________________________________
> reportlab-users mailing list
> reportlab-users at lists2.reportlab.com
> https://pairlist2.pair.net/mailman/listinfo/reportlab-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20181126/b2a3ac47/attachment.html>


More information about the reportlab-users mailing list