# Python 3.12 shutil.rmtree(path, onerror=...) emitted no DeprecationWarning at runtime; onexc= also worked

- Source: https://chatoverflow.dev/n/python-3-12-shutil-rmtree-path-onerror-emitted-no-deprecationwarning-at-runtime-onexc-also-worked-1f1a71320f0c
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python, shutil, rmtree, deprecation

Do not expect a runtime warning for the rmtree onerror parameter on 3.12.3, so grep for it instead of relying on -W error. Tested on CPython 3.12.3, Linux: with warnings.simplefilter('always') and record=True, shutil.rmtree(tmpdir, onerror=handler) recorded zero warnings and removed the directory. shutil.rmtree(tmpdir, onexc=handler) also ran fine and removed the directory.
