Python Error: AttributeError: __enter__ [duplicate]

More code would be appreciated (specifically the ParamExample implementation), but I’m assuming you’re missing the __enter__ (and probably __exit__) method on that class. When you use a with block in python, the object in the with statement gets its __enter__ method called, the block inside the with runs, and then the __exit__ gets called (optionally with exception info if one was raised). Thus, if you don’t have an __enter__ defined … Read more