Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

qtconsole: Fix non-empty namespace at startup.

Fixes `IPython.core.usage` being in the namespace as `usage`:

    In [1]: usage
    Out[1]: <module 'IPython.core.usage' from 'IPython/core/usage.pyc'>

Closes #2152
  • Loading branch information...
commit 2bf631bc31d528e2dc06f5060032162d22081090 1 parent 54e6c7d
@bfroehle bfroehle authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 IPython/frontend/qt/console/ipython_widget.py
View
8 IPython/frontend/qt/console/ipython_widget.py
@@ -272,8 +272,12 @@ def _started_kernel(self):
def _load_guiref_magic(self):
"""Load %guiref magic."""
self.kernel_manager.shell_channel.execute('\n'.join([
- "from IPython.core import usage",
- "get_ipython().register_magic_function(usage.page_guiref, 'line', 'guiref')",
+ "try:",
+ " _usage",
+ "except:",
+ " from IPython.core import usage as _usage",
+ " get_ipython().register_magic_function(_usage.page_guiref, 'line', 'guiref')",
+ " del _usage",
]), silent=True)
#---------------------------------------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.