[IPython-user] Closing an embedded IPython Shell.
Wed Jul 29 12:16:08 CDT 2009
I have a GUI open in a dedicated thread. IPython is running in the
shell. When I close the GUI, I want IPython to close. I call
ipshell.magic_Exit() from the GUI thread when the GUI thread exits.
This terminates the shell but the shell doesn't go back to the
terminal prompt until I hit Enter. (It's not waiting for the confirm
exit, it's stuck on waiting for stdin.)
On Jul 29, 2009, at 11:01 AM, Brian Granger wrote:
> Hmm, I am puzzled. If I save the code below to a file
> (embedexit.py) and then do:
> python embedexit.py
> I get an IPython prompt and can use it interactively. I can then
> close it by doing:
> In : Exit
> In : exit()
> And the shell closes immediately. I want to understand what you are
> doing different. Could you clarify?
> On Tue, Jul 28, 2009 at 2:53 PM, Dennis Muhlestein <firstname.lastname@example.org
> > wrote:
> On Jul 27, 2009, at 10:42 AM, Brian Granger wrote:
> I think you have 2 options:
> 1. Modify confirm_exit in ipythonrc to be 0 (default is 1).
> 2. Create your embedded ipython like this to override the setting
> without changing your config file
> from IPython.Shell import IPShellEmbed
> from IPython.ipstruct import Struct
> myconfig = Struct()
> Its a no-go. The shell doesn't pop up the confirm exit anyway
> because the magic_Exit() function I'm using doesn't call that. The
> issue is that the shell is hung waiting for some input from stdin.
> It doesn't drop back to a terminal unless I hit enter.
More information about the IPython-user