tags:

views:

29

answers:

1

I'm embedding iPython shell in a Django script (with development server, e.g. runserver at localhost) like this:

...
from IPython.Shell import IPShellEmbed
ipshell = IPShellEmbed()
ipshell()
...

which gives me interactive shell at the desired place. Now, if modify the source code, Django automatically reloads, probably without correctly quitting iPython shell, and "breaks" my terminal emulator (xterm, konsole) - text becomes invisible, etc. (same effect if iPython running inside Django is terminated with Ctrl+d).

Any suggestions as what could be causing this? (I'm probably using iPython in a wrong way, but who knows).

+1  A: 

I cannot answer the question why it's going wrong, but I can tell you how to recover from it: quit the debugging server and give the reset command.

Another way to prevent this from happening is to use the --reload switch on the runserver command. This means that Django will not reload after a change, but it also doesn't break your debugger.

Mark van Lent