I'm getting inconsistent responses from the Keyboard interrupt Ctrl+C in interactive python (run in xterm) after plotting from matplotlib.
As expected, when executing Ctrl+C inside ipython2 I get the KeyboardInterrupt
message.
However, once I plot anything using matplotlib (specifically matplotlib.pyplot) Ctrl+C will exit the interactive python session, as opposed to exiting the running script in the interactive python session (if there is one).
A primitive example.
import numpy as n
import matplotlib.pyplot as m
x = n.linspace(0,4*n.pi,500)
y = x**2*n.sin(x)
m.plot(x,y)
m.show()
Preferrable behavior would be for Ctrl+C to always only interrupt a running script (if any is running), instead of the interactive python session itself.
I did have the same problem for a long time. Try to run ipython with qt:
ipython --matplotlib=qt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With