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 on your class, you’ll see this error.
Side note: you need to either indent the second
with block so it’s 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