Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#12735 closed (fixed)

django shell is broken with IPython 0.11.x (bzr.r1219)

Reported by: alperkanat Owned by: nobody
Component: Core (Management commands) Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:

Description (last modified by ramiro)

[15:33] (tunix@penguix raptiye)$ ./ shell
Traceback (most recent call last):
  File "./", line 14, in <module>
  File "/Users/tunix/Projects/django/core/management/", line 438, in execute_manager
  File "/Users/tunix/Projects/django/core/management/", line 379, in execute
  File "/Users/tunix/Projects/django/core/management/", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/Users/tunix/Projects/django/core/management/", line 222, in execute
    output = self.handle(*args, **options)
  File "/Users/tunix/Projects/django/core/management/", line 351, in handle
    return self.handle_noargs(**options)
  File "/Users/tunix/Projects/django/core/management/commands/", line 29, in handle_noargs
    shell = IPython.Shell.IPShell(argv=[])
AttributeError: 'module' object has no attribute 'Shell'

It seems that Shell module is deprecated:

In [1]: from IPython import Shell
/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/IPython/ DeprecationWarning: 
This module (IPython.Shell) is deprecated.  The classes that were in this
module have been replaced by:


Please migrate your code to use these classes instead.

  warn(msg, category=DeprecationWarning, stacklevel=1)

Attachments (1)

django_shell.patch (965 bytes) - added by alperkanat 6 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by ramiro

  • Component changed from Core framework to
  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

(reformatted description)

no 0.11 version of ipython has been released yet, should we wait for a stable release before thinking about adding compatibility code to Django?

Changed 6 years ago by alperkanat

comment:2 Changed 6 years ago by Alex

  • Triage Stage changed from Unreviewed to Accepted

comment:3 follow-up: Changed 5 years ago by ramiro

#13554 reported the same issue against the now stable 0.11 IPython release and contains a similar patch.

comment:4 in reply to: ↑ 3 Changed 5 years ago by ramiro

Replying to ramiro:

... against the now stable 0.11 IPython release.

Wrong. IPython 0.1 hasn't been released yet.

comment:5 Changed 5 years ago by mk

  • Has patch set
  • Patch needs improvement set

Most of the time we try the "new way" to do things first and fall back to the old way if it didn't work out.

Plus, a comment explaining why we need this try...except clause is in order too.

    shell = IPython.InteractiveShell()
except AttributeError:
    # IPython < 0.11
    # Explicitly pass an empty list as arguments, because otherwise IPython
    # would use sys.argv from this script.
    shell = IPython.Shell.IPShell(argv=[])

comment:6 Changed 5 years ago by jezdez

  • Resolution set to fixed
  • Status changed from new to closed

(In [14895]) Fixed #12735, #14892 and #11542 -- Fixed support for the latest IPython (development) version in the shell management command and added a hook to implement additional shell runners (by subclassing, extending the shells attribute and implement a method with the same name).

comment:7 Changed 5 years ago by jezdez

(In [14910]) [1.2.X] Fixed #12735 and #14892 -- Fixed support for the latest IPython (development) version in the shell management command.

Backport from trunk (r14895).

Note: See TracTickets for help on using tickets.
Back to Top