Python Error: AttributeError: __enter__
More code would be appreciated (specifically the
ParamExample implementation), but Im assuming youre 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 dont have an
__enter__ defined on your class, youll see this error.
Side note: you need to either indent the second
with block so its actually inside the first, OR replace these two lines with
with ParamExample(URI) as pe, MotionCommander(pe, default_height=0.3) as mc:
which is the same as nesting these two context managers (the name of the objects used by