add tag
user202729
Put the following in `a.py`:

```
#!/bin/python3
try:
	while True: pass
except KeyboardInterrupt:
	pass
```

Run with `python a.py`:

```
$ python a.py
```

Press `Ctrl+C` to interrupt it:

```
^CTraceback (most recent call last):
  File "/tmp/a.py", line 3, in <module>
    while True: pass
KeyboardInterrupt
```

Why is the error still printed and not captured?

Python version: Python 3.11.3, on Linux.

This room is for discussion about this question.

Once logged in you can direct comments to any contributor here.

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.