Whew, this is much more complicated then. A few comments:<br><br>* Is your GUI running in the main thread? Most GUI toolkits I know of get very grumpy if they are not run in the main thread. This alone could cause problems.<br>
<br>* Are you uses IPython's threaded shells to integrate ipython with the GUI? If not, can you better describe how the two are integrated.<br><br>* Sometime very soon (like next week) we will be merging some new code into the ipython trunk that will have a much better way of doing GUI integration (it doesn't require threads). While I haven't tested it with embedding, it should make these things much simpler. Note: this new stuff won't be in the upcoming 0.10 release.<br>
<br>Cheers,<br><br>Brian<br><br><div class="gmail_quote">On Wed, Jul 29, 2009 at 10:16 AM, Dennis Muhlestein <span dir="ltr"><<a href="mailto:djmuhlestein@gmail.com">djmuhlestein@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
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.)<br>
<font color="#888888">
<br>
-Dennis</font><div><div></div><div class="h5"><br>
<br>
On Jul 29, 2009, at 11:01 AM, Brian Granger wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Dennis,<br>
<br>
Hmm, I am puzzled. If I save the code below to a file (embedexit.py) and then do:<br>
<br>
python embedexit.py<br>
<br>
I get an IPython prompt and can use it interactively. I can then close it by doing:<br>
<br>
In [3]: Exit<br>
<br>
or<br>
<br>
In [3]: exit()<br>
<br>
And the shell closes immediately. I want to understand what you are doing different. Could you clarify?<br>
<br>
Cheers,<br>
<br>
Brian<br>
<br>
On Tue, Jul 28, 2009 at 2:53 PM, Dennis Muhlestein <<a href="mailto:djmuhlestein@gmail.com" target="_blank">djmuhlestein@gmail.com</a>> wrote:<br>
<br>
On Jul 27, 2009, at 10:42 AM, Brian Granger wrote:<br>
<br>
I think you have 2 options:<br>
<br>
1. Modify confirm_exit in ipythonrc to be 0 (default is 1).<br>
<br>
2. Create your embedded ipython like this to override the setting without changing your config file<br>
<br>
from IPython.Shell import IPShellEmbed<br>
from IPython.ipstruct import Struct<br>
myconfig = Struct()<br>
myconfig.confirm_exit=0<br>
ipshell=IPShellEmbed(rc_override=myconfig)<br>
ipshell()<br>
<br>
<br>
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.<br>
<br>
-Dennis<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br>