Re: ReportLab and Django Examples

Mike Hostetler <[email protected]>
Newsgroups gmane.comp.python.reportlab.user
Message-ID <CAE1_9RUtYjfJL3Rh5Ayi_AT3zWVRVi8THr2ZX2iDo1ayUcy_QQ@mail.gmail.com>
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 <[email protected] 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 <[email protected]>
> 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
> > [email protected]
> > 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
> [email protected]
> https://pairlist2.pair.net/mailman/listinfo/reportlab-users
>
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.