Openai Gym Env.p, Attributeerror 'timelimit' Object Has No Attribute 'p'
I'm currently reading Hands-On Reinforcement Learning with Python by Sudharsan Ravichandiran and on one of the first examples I run into this AttributeError: AttributeError 'TimeLi
Solution 1:
Try to unwrap the env first by adding this
env = env.unwrapped
Solution 2:
Try this,
for next_sr in env.env.P[state][action]:
Note the extra 'env' at start
For general use, try
>>>dir(class_name)
this will give list of member function.
Solution 3:
If you are using a recent version of OpenAI Gym, the solution proposed in this github issue link worked for me.
As explained in the github issue, monitoring in the latest version of gym been replaced by wrappers, therefore monitoring will not work with the latest gym. To reimplement monitoring in a recent version of Gym, chang the code that resembles :
env.monitor.start('cartpole-hill/', force=True)
to
env = gym.wrappers.Monitor(env,directory='cartpole-hill/',force=True,write_upon_reset=True)
Post a Comment for "Openai Gym Env.p, Attributeerror 'timelimit' Object Has No Attribute 'p'"