.. _not-context-manager:

not-context-manager / E1129
===========================

**Message emitted:**

Context manager '%s' doesn't implement __enter__ and __exit__.

**Description:**

*Used when an instance in a with statement doesn't implement the context manager protocol(__enter__/__exit__).*

**Problematic code:**

.. literalinclude:: /data/messages/n/not-context-manager/bad.py
   :language: python

**Correct code:**

.. literalinclude:: /data/messages/n/not-context-manager/good.py
   :language: python



Created by the `typecheck <https://github.com/PyCQA/pylint/blob/main/pylint/checkers/typecheck.py>`__ checker.