If I execute a command in the interactive mode in python in Visual Studio with the Python Tools for Visual Studio IDE, I would like to be able to interrupt that command with a set of keystrokes e.g CTRL + C as in MATLAB.
The PTVS docs on interactive mode don't mention anything in particular. Google searches turned up empty.
In Python, there is no special syntax for the KeyboardInterrupt exception; it is handled in the usual try and except block. The code that potentially causes the problem is written inside the try block, and the 'raise' keyword is used to raise the exception, or the python interpreter raises it automatically.
The stop button, which is red square outline, does this job. Your running code will respond as if it had a keyboard interrupt.
Note: This is an old question, but I ended up here by googling and found no useful answer, so I posted this one once I found it.
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