Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix IPython.Shell compatibility layer #286

Closed
astrofrog opened this Issue · 5 comments

4 participants

Thomas Robitaille Robert Kern alainS mhb0925
Thomas Robitaille

It looks like there is supposed to be a compatibility layer for IPython.Shell but it is not working:

Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import IPython.Shell
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Shell

and trying to execute the import statement from Shell.py gives:

>>> from IPython.core.embed import InteractiveShellEmbed as IPShellEmbed
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named embed
>>> 

What is the most up-to-date way to access IPython.Shell?

Robert Kern
Collaborator

There is no compatibility layer. Shell.py has moved to IPython.deathrow.Shell and should not be used. InteractiveShellEmbed has moved to IPython.frontend.terminal.embed.InteractiveShellEmbed, although I recommend using the embed() function in that module.

Thomas Robitaille

Thanks - are there any replacements for the following?

IPython.Shell.IPShellMatplotlibQt4
IPython.Shell.IPShellMatplotlibWX
IPython.Shell.IPShellMatplotlibGTK
IPython.Shell.IPShellMatplotlibQt
Robert Kern
Collaborator
alainS

The way I understand it you should now be able to simply start a console by

import IPython
IPython.embed()

However, this raises

TraitError: The 'exit_msg' trait of an InteractiveShellEmbed instance must be a string, but a value of u'' was specified.

If we pass a string for exit_msg by

IPython.embed(exit_msg='Whatever')

Then it raises a different error

AttributeError: 'InteractiveShellEmbed' object has no attribute 'set_completer'

Am I missing something here? I am using Python 2.6.1. Thanks a lot.

mhb0925

Replace

import IPython.Shell
IPython.Shell.start().mainloop()

with

import IPython
IPython.embed()

on /opt/local/bin/ipython

This issue was closed.
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.