Question

My ipython config file is not being loaded by django_extensions' shell_plus.

My ipython config file contains:

c.InteractiveShellApp.exec_lines = ['aa=5',]

testing it:

(virtualenv) $ ipython
>>>  ....
In [1]: aa
Out[1]: 5

works. Now, testing the ipython called through django_extensions:

(virtualenv) $ python manage.py shell_plus

this gets me into ipython (highlighting works, %run works etc.), but without my config loaded:

In [1]:aa
NameError: name 'aa' is not defined

How can I make it work?

Was it helpful?

Solution

It's because shell_plus.py uses IPython.embed not IPython.start_ipython to start the shell. Embed doesn't load your configuration file. Change the code or use things like SHELL_PLUS_PRE_IMPORTS to load what you want.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top