I want to capture Ctrl+C in my Python code in Visual Studio Code. In both integrated and external consoles, Ctrl+C results in "forrtl: error (200): program aborting due to control-C event" and my try-except statement doesn't catch the interrupt. The code is in this form:
def main():
    try:
        somecode
    except KeyboardInterrupt:
        somecode
 
    