-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
SIGINT is ignored by MacOSX backend #3991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I've found a workaround to make script exit on sigint. Backend's event loop seems to block (
I set the timer interval to 5 sec to make it sensible that signal arrives only after timer event happens. |
attn @mdehoon |
This is an interesting idea. I wonder if this approach (the timer, that is) On Sat, Jan 10, 2015 at 9:41 AM, Thomas A Caswell notifications@github.com
|
@WeatherGod Which other issues are there with the macosx backend and its event loop? |
I assume @WeatherGod is referring to |
When working on event loops, one has to resist the urge to use tricks to solve issues. Tricks may solve a particular symptom but you will end up with a bunch of hacks that will be very difficult to disentangle. |
@tacaswell The bug in that case is not caused by the MacOSX backend, but by the upstream code trying to draw stuff outside of the event loop. |
@mdehoon, Fair enough. and I can see a bunch of problems with the idea for On Mon, Jan 12, 2015 at 9:28 PM, mdehoon notifications@github.com wrote:
|
@WeatherGod The suggested bug fix should not be applied, as this is not a bug in the MacOSX backend, but in Python itself. See issue 3180 on the Python website: |
This pull request #4006 allows the delivery of interrupts once Python is fixed. |
Can someone on OSX try to reproduce using the snippet in OP? |
I can still reproduce the original problem (Ctl-C does not close the window) with master and python 3.5.2 from Anaconda. |
https://bugs.python.org/issue23237 <- @mdehoon 's upstream patch is still not merged, closing as there is nothing we can do about this. |
@efiring does this problem also persist with mpl 2.0.0rc2 + IPython? |
I can't run it from ipython on my system; I am using Anaconda, which is running ipython with a non-framework build of python. I can only test it as a standalone script using pythonw. |
Here is an example:
Run this script from terminal, wait for the window to appear and press Ctrl-C (in terminal). The script will not die.
Then uncomment the
matplotlib.use
line an Ctrl-C will work as intended.UPD:
If I press Ctrl-C and then move mouse over the plot window the following exception appears in the log:
The same is for callback set using
signal.signal(signal.SIGTERM, cb)
, callback is not called until window receives any event (focus change, mouse move, etc).The text was updated successfully, but these errors were encountered: