You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just created a new Pyramid project on Fedora 19, with Python 2.7.4
Starting the app, I get the below traceback (last few lines because it is very long) :
Traceback (most recent call last):
File "/home/bochecha/Workspace/loopapp/venv/lib/python2.7/site-packages/pyramid-1.4.1-py2.7.egg/pyramid/mako_templating.py", line 207, in __call__
result = template.render_unicode(**system)
File "/home/bochecha/Workspace/loopapp/venv/lib/python2.7/site-packages/Mako-0.8.0-py2.7.egg/mako/template.py", line 452, in render_unicode
as_unicode=True)
File "/home/bochecha/Workspace/loopapp/venv/lib/python2.7/site-packages/Mako-0.8.0-py2.7.egg/mako/runtime.py", line 783, in _render
**_kwargs_for_callable(callable_, data))
File "/home/bochecha/Workspace/loopapp/venv/lib/python2.7/site-packages/Mako-0.8.0-py2.7.egg/mako/runtime.py", line 815, in _render_context
_exec_template(inherit, lclcontext, args=args, kwargs=kwargs)
File "/home/bochecha/Workspace/loopapp/venv/lib/python2.7/site-packages/Mako-0.8.0-py2.7.egg/mako/runtime.py", line 841, in _exec_template
callable_(context, *args, **kwargs)
File "/home/bochecha/Workspace/loopapp/venv/lib/python2.7/site-packages/pyramid_debugtoolbar-1.0.6-py2.7.egg/pyramid_debugtoolbar/panels/templates/versions.dbtmako", line 2, in render_body
<div>${platform}</div>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 152: ordinal not in range(128)
The problem is that Fedora 19 is codenamed « Schrödinger’s Cat ».
Python 2.7 sees that as:
$ python
Python 2.7.4 (default, Apr 22 2013, 07:21:08)
[GCC 4.8.0 20130412 (Red Hat 4.8.0-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'Linux-3.9.0-0.rc7.git3.1.fc19.x86_64-x86_64-with-fedora-19-Schr\xc3\xb6dinger\xe2\x80\x99s_Cat'
And so the platform variable passed to the Mako template is a bytes string containing non-ascii chars, which causes the UnicodeDecodeError exception.
Editing pyramid_debugtoolbar/panels/versions.py to add a simple .decode('utf-8') where appropriate fixes the issue.
That might not be the proper fix though.
Finally, note that the problem is limited to Python 2, because Python 3 returns a unicode string:
$ python3
Python 3.3.1 (default, Apr 11 2013, 09:14:58)
[GCC 4.8.0 20130322 (Red Hat 4.8.0-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import platform
>>> platform.platform()
'Linux-3.9.0-0.rc7.git3.1.fc19.x86_64-x86_64-with-fedora-19-Schrödinger’s_Cat'
The text was updated successfully, but these errors were encountered:
It causes issues on some systems (e.g Fedora 19):
Pylons/pyramid_debugtoolbar#97
And it has limited value anyway, so let's avoid the trouble to all
people trying to setup a development instance.
I just created a new Pyramid project on Fedora 19, with Python 2.7.4
Starting the app, I get the below traceback (last few lines because it is very long) :
The problem is that Fedora 19 is codenamed « Schrödinger’s Cat ».
Python 2.7 sees that as:
And so the
platform
variable passed to the Mako template is a bytes string containing non-ascii chars, which causes theUnicodeDecodeError
exception.Editing
pyramid_debugtoolbar/panels/versions.py
to add a simple.decode('utf-8')
where appropriate fixes the issue.That might not be the proper fix though.
Finally, note that the problem is limited to Python 2, because Python 3 returns a unicode string:
The text was updated successfully, but these errors were encountered: