JuliaPy / PyCall.jl

Package to call Python functions from the Julia language
MIT License
1.46k stars 187 forks source link

catch keyboard interrupts during Python execution #27

Open stevengj opened 11 years ago

stevengj commented 11 years ago

Currently, keyboard interrupts are deferred during execution of Python code, since CPython is not interrupt-safe. It would be nice to catch these interrupts and set a KeyboardInterrupt Python exception so that Python code is halted gracefully.

StephenVavasis commented 8 years ago

Currently (Windows 8.1, Julia 0.4.5, PyCall 1.6.1, PyPlot 2.1.1) I see the opposite problem. Once my Julia program starts making PyPlot calls, then ctrl-c is no longer able to interrupt the running Julia program until it reaches the next PyPlot invocation.

damiendr commented 6 years ago

Agreed that this would be nice. In my case this mostly bites in combination with IJulia -- if I accidentally ask PyPlot to draw something that takes forever, the only way to interrupt it is to restart the notebook (and lose all the previous results).

athre0z commented 4 years ago

This is also my primary reason for annoyance in this otherwise excellent library, also while working in IJulia. If this is reasonably easy to implement, that would be greatly appreciated!

Quantisan commented 5 months ago

related discussion over at PythonCall https://github.com/JuliaPy/PythonCall.jl/issues/219