Skip to content Skip to sidebar Skip to footer

Unable To Stop The Program The First Time I Press `ctrl + C`

I have a tcp receiver which is listening for incoming images. I also have a foo() def that runs simultaneously and prints the current time every 5 seconds. Here is the code: from _

Solution 1:

Just reraise the exception after the print statement:

except KeyboardInterrupt:
    print('\nClosing') 
    raise

Post a Comment for "Unable To Stop The Program The First Time I Press `ctrl + C`"