Closed DuaneNielsen closed 4 years ago
Hi, this specific spec object is required by the OpenAI gym interface, and is an instance of its EnvSpec class. That said, any environment/wrapper extending from OpenAI gym interface should follow its API and include the spec object.
Additionally, a Wrapper class is distinct from an Env class, and it needs to inherit that from its env object. You may follow this example to do so. Let me know if this solves your problem!
Thanks. Yes that's the example I was following and that's the way I "fixed" the problem.
On the face of it though, it just looks like there is problem in the inheritance hierarchy. It's unusual to have to add a "magic" value to an base class function to make things work, even if it's an "edge case. Usually the convention is that the base class constructor requires you to add everything needed.
Anyway, all good, just thought I'd mention it in case it was an oversight. Seems like that's the design, which is OK.
Describe the bug when writing a new VectorEnvWrapper by extending baseclass VectorEnvWrapper, it appears calling super is not enough to make it work. Seems that the OpenAIEnv constructor expects a wrapper to carry a spec attribute, which is not present in VectorEnvWrapper base class.
To Reproduce
git rev-parse HEAD
to get it): 41e69186c69494d5a1f87b3299bda772eefac150spec
file used: not relevant, self evident from code reviewAdditional context
The below is required to implement a working wrapper... removing the self.spec = venv.spec causes it to fail, due to the reference in the OpenAIEnv class constructor.
The reference to spec is used in OpenAIEnv on the below line.
Context below...
Perhaps this should be initialized in the base class? Not sure of the correct fix as I"m not yet familiar with the overall design.