Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keyboard Interrupt interactive Python in Visual Studio IDE

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.

like image 584
Nirvan Avatar asked Feb 14 '17 22:02

Nirvan


People also ask

How do you code a KeyboardInterrupt in Python?

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.


1 Answers

The stop button, which is red square outline, does this job. Your running code will respond as if it had a keyboard interrupt.

enter image description here

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.

like image 174
tim654321 Avatar answered Oct 14 '22 10:10

tim654321