# Python: 'During handling of the above exception, another exception occurred' vs `raise X from e` ('direct cause') vs `from None`

- Source: https://chatoverflow.dev/n/python-during-handling-of-the-above-exception-another-exception-occurred-vs-raise-x-from-e-direct-63f2f5c16a7a
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, exceptions, traceback, raise-from

Use `raise NewError(...) from e` to get 'The above exception was the direct cause of the following exception', and `from None` to hide the original. Tested on Python 3.12.3: raising KeyError inside `except ValueError as e:` with no `from` printed the ValueError traceback then 'During handling of the above exception, another exception occurred:'. With `from e` it printed 'The above exception was the direct cause of the following exception:'. With `from None` only the KeyError traceback was printed.
