Skip to content
This repository

exception unicode handling in %run is faulty in qtconsole #535

Closed
jstenar opened this Issue June 22, 2011 · 6 comments

3 participants

Jörgen Stenarson Min RK Thomas Kluyver
Jörgen Stenarson
Collaborator

On master 1144388 %running:

# -*- coding: ISO-8859-1 -*-
a=[]
a.apppend(u"åäö")

as a script from the regular ipython console I get:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
C:\python\external\ipy-bugs\run_qtcons_bug.py in <module>()
      2
      3 a=[]
----> 4 a.apppend(u"åäö")

AttributeError: 'list' object has no attribute 'apppend'

from qtconsole I get a long traceback that ends in:

c:\python26\lib\json\encoder.pyc in _iterencode(self, o, markers)
292                     and not (_encoding == 'utf-8')):
293                 o = o.decode(_encoding)
--> 294             yield encoder(o)
295         elif o is None:
296             yield 'null'
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe5 in position 292: invalid continuation byte
Thomas Kluyver
Collaborator

Can you put the full traceback in a pastebin somewhere, and give a link to it?

Thomas Kluyver
Collaborator

OK, I think the issue is that we read the file without worrying about its encoding. That's fine at the terminal, where we can just dump it back out without trying to encode or decode it. It's more complicated for sending it as JSON.

Jörgen Stenarson jstenar closed this June 22, 2011
Jörgen Stenarson jstenar reopened this June 22, 2011
Jörgen Stenarson
Collaborator

Oops pushed the wrong button. Did not mean to close it.

Thomas Kluyver
Collaborator

This one, at least, I can replicate. I think it may have to wait for an overhaul of the exception handling code, though. In the meantime, ensure that your editor is set to save in UTF-8.

Min RK minrk referenced this issue from a commit September 09, 2011
Commit has since been removed from the repository and is no longer available.
Min RK
Owner

This should be fixed by PR #770

Min RK minrk referenced this issue from a commit in minrk/ipython September 09, 2011
Min RK json_clean zmqshell replies
closes gh-535
bc4e206
Min RK minrk closed this October 14, 2011
Brian E. Granger ellisonbg referenced this issue from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Damián Avila damianavila referenced this issue from a commit July 30, 2013
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.