Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-python kernels run python code with qtconsole #4787

Merged
merged 1 commit into from Jan 13, 2014
Merged

Conversation

sn6uv
Copy link
Contributor

@sn6uv sn6uv commented Jan 13, 2014

When launching the qtconsole with a non-python kernel it crashes immediately since the frontend requests that the following code is run by the kernel:

try:
    _usage
except:
    from IPython.core import usage as _usage
    get_ipython().register_magic_function(_usage.page_guiref, 'line', 'guiref')
    del _usage

obviously only python kernels understand and can execute this.

Either we

  • check the language of the kernel first (with a kernel_info_request message).
  • find another way to register the magic functions for python kernels.

@minrk
Copy link
Member

minrk commented Jan 12, 2014

I think following a kernel_info request is a good idea.

@ghost ghost assigned minrk Jan 13, 2014
@minrk
Copy link
Member

minrk commented Jan 13, 2014

Thanks! When you turn an Issue into a PR, it's probably a good idea to ping with a comment, because just turning it into a PR doesn't seem to cause any notification.

minrk added a commit that referenced this pull request Jan 13, 2014
Don't execute guiref code in qtconsole unless kernel is Python
@minrk minrk merged commit 591ffc6 into ipython:master Jan 13, 2014
""" Handle kernel info replies.
"""
if not self._guiref_loaded:
if rep['content']['language'] == 'python':
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be a potential problem. i.e. if the kernel doesn't implement the language field this could crash with KeyError.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

arg, good point. Better to be safe here.

mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this pull request Nov 3, 2014
Don't execute guiref code in qtconsole unless kernel is Python
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants