Opened 13 years ago

Last modified 12 years ago

#18204 closed Bug

manage.py shell w/ IPython embed does not work well — at Initial Version

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

Description

#17078 introduced the usage of IPython.embed(). This also introduced the bug described in the bottom part of https://github.com/ipython/ipython/issues/62 to the IPython shell opened by Django. For example:

def foo():

... print foo

foo()

...
NameError: global name 'foo' is not defined

The issue https://github.com/ipython/ipython/issues/62 just solved for normal IPython shell, not for embed calling from function, which is used in current Django, as in django/core/management/commands/shell.py

def ipython(self):

...

from IPython import embed
embed()

...

Some quotes of takluyver from IPython team in the github link above

It's possible for Django to start IPython in a way that won't cause this problem, but that's not the way we currently make easy. The problem occurs when IPython starts with separate local and global namespaces. There's no reason that Django requires separate local and global namespaces, but that's what calling embed() inside a function implies.

My env: Django 1.4 and 1.5 alpha w/ IPython 0.12 and 0.12.1

Change History (0)

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