I've got a program with a console menu. I use input() to, well, get user input. But when I want to force-restart/terminate program execution in PyCharm or close IDE entirely, the program keeps running until I enter anything.
This snippet is a stripped-down version:
while True:
inp = input()
if inp == 'hi':
print('hello there')
elif inp == 'exit':
break
else:
print('unknown command')
and prints out in console:
KeyboardInterrupt
Process finished with exit code -1073741510 (0xC000013A: interrupted by Ctrl+C)
I've done some research:
- -This is probably an IDE-only issue, as...
- -Enabling "Emulate terminal in output console" stops this bug from occurring.
But I think it's just a workaround, and I'd like to know more about why this is happening. Also have you encountered this before?