Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
jstenar opened this Issue · 6 comments

3 participants

Jörgen Stenarson Thomas Kluyver Min RK
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
Owner

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

Thomas Kluyver
Owner

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
Jörgen Stenarson jstenar reopened this
Jörgen Stenarson
Collaborator

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

Thomas Kluyver
Owner

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
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
Min RK minrk json_clean zmqshell replies
closes gh-535
bc4e206
Min RK minrk was assigned
Min RK minrk closed this
Brian E. Granger ellisonbg referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Damián Avila damianavila referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
matthew von rocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
Min RK minrk json_clean zmqshell replies
closes gh-535
1c8d411
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.