Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.2.X] Fixed #12735 and #14892 -- Fixed support for the latest IPyth…

…on (development) version in the shell management command.

Backport from trunk (r14895).

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.2.X@14910 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 2ab1e928540a4b38f5d3d639312e9978e0aa4363 1 parent 4803410
@jezdez jezdez authored
Showing with 15 additions and 5 deletions.
  1. +15 −5 django/core/management/commands/shell.py
View
20 django/core/management/commands/shell.py
@@ -23,11 +23,21 @@ def handle_noargs(self, **options):
if use_plain:
# Don't bother loading IPython, because the user wants plain Python.
raise ImportError
- import IPython
- # Explicitly pass an empty list as arguments, because otherwise IPython
- # would use sys.argv from this script.
- shell = IPython.Shell.IPShell(argv=[])
- shell.mainloop()
+ try:
+ from IPython.frontend.terminal.embed import TerminalInteractiveShell
+ shell = TerminalInteractiveShell()
+ shell.mainloop()
+ except ImportError:
+ # IPython < 0.11
+ # Explicitly pass an empty list as arguments, because otherwise
+ # IPython would use sys.argv from this script.
+ try:
+ from IPython.Shell import IPShell
+ shell = IPShell(argv=[])
+ shell.mainloop()
+ except ImportError:
+ # IPython not found at all, raise ImportError
+ raise
except ImportError:
import code
# Set up a dictionary to serve as the environment for the shell, so

0 comments on commit 2ab1e92

Please sign in to comment.
Something went wrong with that request. Please try again.