qtconsole --pure: "TypeError: string indices must be integers, not str" #519

Closed
mspacek opened this Issue Jun 13, 2011 · 1 comment

Comments

Projects
None yet
2 participants
Contributor

mspacek commented Jun 13, 2011

Not that I ever want to run in pure Python mode, but I keep testing it and finding problems. Running ipython-qtconsole --pure I get this:

>>> a = 1
>>> a
>>> 

i.e. the value of a isn't printed. I get this in the parent terminal:

{'content': {'user_variables': [], 'code': 'a\n', 'user_expressions': {}, 'silent': False},
 'header': {'username': 'mspacek', 'msg_id': 1, 'session': '6ceda2c2-593f-4741-bd5c-8c8969a2288a'},
 'msg_type': 'execute_request',
 'parent_header': {}}
{'content': {'status': 'ok', 'payload': {}},
 'header': {'username': u'kernel', 'msg_id': 4, 'session': '4dcdb4cc-eef5-4c86-a915-ccfb26458ca9'},
 'msg_type': u'execute_reply',
 'parent_header': {'username': 'mspacek', 'msg_id': 1, 'session': '6ceda2c2-593f-4741-bd5c-8c8969a2288a'}}
Traceback (most recent call last):
  File "/home/mspacek/source/ipython/IPython/frontend/qt/base_frontend_mixin.py", line 102, in _dispatch
    handler(msg)
  File "/home/mspacek/source/ipython/IPython/frontend/qt/console/frontend_widget.py", line 372, in _handle_pyout
    self._append_plain_text(msg['content']['data']['text/plain'] + '\n')
TypeError: string indices must be integers, not str

Since I hadn't noticed it before, I think this may be a new problem from a recent commit. I suppose this might be related to #516.

Owner

minrk commented Jun 14, 2011

No, this is not new. It is related to #516 in that the FrontendWidget assumes that messages come from IPython object inspection, and not the reduced reply given by the pure Python kernel. If you confirm that #521 fixes this and #516 for you, I will go ahead and merge it.

minrk closed this in b5570f7 Jun 14, 2011

@pombredanne pombredanne added a commit to pombredanne/ipython that referenced this issue Jun 17, 2011

@minrk @pombredanne minrk + pombredanne use dict.get(key) instead of dict[key] for pure kernel
This protects against missing keys in object introspection, etc.
when using the pure Python kernel.

closes gh-516
closes gh-519
26cd095

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

@minrk minrk use dict.get(key) instead of dict[key] for pure kernel
This protects against missing keys in object introspection, etc.
when using the pure Python kernel.

closes gh-516
closes gh-519
004dff4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment