Hi!
I have a problem with pdf output running in python3 environment. The
problem I'm trying to solve is more complex, but I managed to strip it down
to a very small example. If I get this running, I'm sure to manage in my
actual situation.
I created a new application with a controller like this:
# -*- coding: utf-8 -*-
def index():
return dict(
data=UL(
A('Output html', _href=URL(print, extension='html')),
A('Output pdf', _href=URL(print, extension='pdf'))
),
message="hello from tiatpi.py")
def print():
return dict(content='Data with "dschörmän" Umlauts')
Pressing the first link I get presented with expected web page.
Pressing on the second link I receive an Internal error:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Traceback (most recent call last):
File "/mnt/c/Users/Silvan Marco
Fin/Desktop/Working/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
File "/mnt/c/Users/Silvan Marco
Fin/Desktop/Working/web2py/applications/pdf_test/views/generic.pdf", line 9, in
<module>
pass
File "/mnt/c/Users/Silvan Marco Fin/Desktop/Working/web2py/gluon/globals.py",
line 434, in write
self.body.write(to_native(xmlescape(data)))
File "/mnt/c/Users/Silvan Marco
Fin/Desktop/Working/web2py/gluon/packages/dal/pydal/_compat.py", line 136, in
to_native
return obj.decode(charset, errors)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 10:
invalid continuation byte
Bevore assembling this small snippet I experimented with the whole
situation for some time now and I never produced anything else than
exceptions, most of them some form of DecordeErorr or EncodingError, so I
assume, there is something wrong with either fpdf or the XML() helper.
I would greatly appreciate any help on this!
Kind regards,
Silvan
Additional Information:
Environment:
I'm running an ubuntu in Windows 10 pro 1909 WSL:
silvan@Nepumuk:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
and from web21py admin pages: 2.18.5-stable+timestamp.2019.04.08.04.22.03
(läuft auf Rocket 1.2.6, Python 3.6.9)
But the problem shows up on native Ubuntu Linux as well.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/83bbc713-d192-4c66-a753-053f296b6a01%40googlegroups.com.