Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPython - "broken" shell/terminal after realoading Django

Tags:

django

ipython

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).

like image 664
user393116 Avatar asked Jul 15 '10 19:07

user393116


2 Answers

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.

like image 66
Mark van Lent Avatar answered Nov 13 '22 02:11

Mark van Lent


This issue is already fixed: http://code.djangoproject.com/ticket/15565

Thanks Django.

like image 42
Potr Czachur Avatar answered Nov 13 '22 04:11

Potr Czachur