{class foo(object): def __enter__ (self): print(\"Enter\") def __exit__(self,type,value,traceback): print(\"Exit\") def method(self):
The problem is that your __enter__ method does not return self.
__enter__
self