Keyboard interrupt Ctrl+c is not equal to Ctrl+F2 in Run window

I am running my script that has the try, except block which handles Keyboard interrupt. However, when I run my script from the Run window, I tried to stop the script using Keyboard interrupt(Ctrl+F2) from Pycharm and the script is terminated with 'Process finished with exit code -1'. The script will be doing some operations on how many threads the script created before Keyboard interrupt in the except block which is not printed.

I also have cygwin in my desktop when I try to do a Keyboard interrupt using Ctrl+c, the script prints the threads created.

Is there any equivalent for the Ctrl+c in Pycharm-Run window?
2 comments
Just posted one thread with same subject. Let me copy here and delete mine
0
Every time I run or debug in PyCharm, the execution cannot be interrupted with Ctrl-C, as it would in MacOS Terminal
I would like to trap the Ctrl-C to take closing actions inside PyCharm, to make sure the process would run smooth in the terminal.
KeyboardInterrupt is probably the Exception I need to look out for, but inside the IDE it is never thrown.
Any help is appreciated.

Thanks
2

Please sign in to leave a comment.