Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

qtconsole --pure: "KeyError: 'ismagic'" #516

Closed
mspacek opened this Issue · 2 comments

3 participants

@mspacek

Running ipython-qtconsole --pure and then typing something like range( that should print out a docstring raises this error:

{'content': {'oname': 'range'},
 'header': {'username': 'mspacek', 'msg_id': 0, 'session': 'b744a851-3e62-4d64-930b-71ddefde10b0'},
 'msg_type': 'object_info_request',
 'parent_header': {}}
{'content': {'docstring': 'range([start,] stop[, step]) -> list of integers\n\nReturn a list containing an arithmetic progression of integers.\nrange(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.\nWhen step is given, it specifies the increment (or decrement).\nFor example, range(4) returns [0, 1, 2, 3].  The end point is omitted!\nThese are exactly the valid indices for a list of 4 elements.'}, 'header': {'username': u'kernel', 'msg_id': 0, 'session': 'c2c4ed08-9765-43c9-b3cf-558331f61237'}, 'parent_header': {'username': 'mspacek', 'msg_id': 0, 'session': 'b744a851-3e62-4d64-930b-71ddefde10b0'}, 'msg_type': 'object_info_reply'}
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 363, in _handle_object_info_reply
    if rep['content']['ismagic']:
KeyError: 'ismagic'
@takluyver
Owner

For that matter, it also can't handle any pyout in pure mode, because it's expecting a format dictionary rather than a string.

In principle, anything that depends on IPython functionality should be in IPythonWidget, which subclasses FrontendWidget. I don't know if that will get sorted out before 0.11.

@minrk
Owner

Simple things like this should be handled with 'get(key)' to prevent KeyErrors.

@minrk minrk closed this issue from a commit
@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
b5570f7
@minrk minrk closed this in b5570f7
@pombredanne pombredanne referenced this issue from a commit in pombredanne/ipython
@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
26cd095
@ellisonbg ellisonbg referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@mattvonrocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
@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
Something went wrong with that request. Please try again.