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

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

Comments

Projects
None yet
3 participants
@jstenar
Member

jstenar commented Jun 22, 2011

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
@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Jun 22, 2011

Member

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

Member

takluyver commented Jun 22, 2011

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

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Jun 22, 2011

Member

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.

Member

takluyver commented Jun 22, 2011

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.

@jstenar

This comment has been minimized.

Show comment
Hide comment

@jstenar jstenar closed this Jun 22, 2011

@jstenar jstenar reopened this Jun 22, 2011

@jstenar

This comment has been minimized.

Show comment
Hide comment
@jstenar

jstenar Jun 22, 2011

Member

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

Member

jstenar commented Jun 22, 2011

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

@takluyver

This comment has been minimized.

Show comment
Hide comment
@takluyver

takluyver Jun 22, 2011

Member

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.

Member

takluyver commented Jun 22, 2011

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.

@minrk

This comment has been minimized.

Show comment
Hide comment
@minrk

minrk Sep 9, 2011

Member

This should be fixed by PR #770

Member

minrk commented Sep 9, 2011

This should be fixed by PR #770

minrk added a commit to minrk/ipython that referenced this issue Sep 9, 2011

@ghost ghost assigned minrk Sep 9, 2011

@minrk minrk closed this Oct 14, 2011

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment