after a quick moment of asking google i saw the suggestions that your error
indicates something wrong with the pickled item....which i think in this
case is the font file. is your font file in the right format to be loaded
by fpdf? (i have no familiarity with this error or fpdf so i'm just
throwing out suggestions).
good luck!
cfh
On Saturday, August 3, 2013 4:40:10 AM UTC-7, Brez Yl wrote:
>
> In FILE:
> /base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py
>
> Traceback (most recent call last):
> File
> "/base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/restricted.py",
> line 212, in restricted
> exec ccode in environment
> File
> "/base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py",
> line 674, in <module>
> File
> "/base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/globals.py",
> line 194, in <lambda>
> self._caller = lambda f: f()
> File
> "/base/data/home/apps/s~myapp/web2py-04.369240954601780983/applications/app3/controllers/default.py",
> line 493, in up_plik
> pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
> File
> "/base/data/home/apps/s~myapp/web2py-04.369240954601780983/gluon/contrib/fpdf/fpdf.py",
> line 432, in add_font
> font_dict = pickle.load(fh)
> File
> "/base/data/home/runtimes/python27p/python27_dist/lib/python2.7/pickle.py",
> line 1378, in load
> return Unpickler(file).load()
> File
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py",
> line 858, in load
> dispatch[key](self)
> File
> "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/pickle.py",
> line 966, in load_string
> raise ValueError, "insecure string pickle"
> ValueError: insecure string pickle
>
>
>
>
> On Saturday, August 3, 2013 10:24:28 AM UTC+2, Christian Foster Howes
> wrote:
>>
>> can you post the stack trace to help us understand what went wrong?
>>
>> On Friday, August 2, 2013 3:19:43 AM UTC-7, Brez Yl wrote:
>>>
>>> Hello!
>>>
>>> I'm writing an app, which results with pdf file with some text with
>>> unicode characters. On local GAE it works good, but after deploy it can't
>>> import crash after add_font() (pyfpdf).
>>>
>>> The code is:
>>>
>>> # -*- coding: utf-8 -*-
>>> def fun1():
>>>
>>> from gluon.contrib.pyfpdf import FPDF, HTMLMixin
>>> class MyFPDF(FPDF, HTMLMixin):
>>> pass
>>>
>>> pdf =MyFPDF()
>>> pdf.add_font('DejaVu', '', 'DejaVuSansCondensed.ttf', uni=True)
>>> pdf.add_page()
>>> pdf.set_font('DejaVu','',16)
>>> pdf.write(10,'testąśł')
>>>
>>> response.headers['Content-Type']='application/pdf'
>>> return pdf.output(dest='S')
>>>
>>> The font files (with a file *DejaVuSansCondensed.pkl* generated after
>>> first run on web2py server...) is in /gluon/contrib/fpdf/font. I didn't
>>> add anything to routers.py (I'm using Pattern-based system) also app.yaml
>>> is not changed.
>>>
>>> As I said on local (both web2py and gae) it works well. After deploy
>>> only something like this works:
>>> pdf =MyFPDF()
>>> pdf.add_page()
>>> pdf.set_font('Arial','',16)
>>> pdf.write(10,'testąśł')
>>>
>>> But without "unusual" characters...
>>>
>>> The best solution would be to add my font files (like DejaVu), but
>>> basically I need unicode characters in any font... maybe some
>>> "half-solution" to use "generic GAE unicode" fonts... if it exist something
>>> like this...
>>>
>>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.