I was trying to implement Atari Games while rendering I get an error as given below:
line 283, in render
raise error.Error(
gym.error.Error: render(mode='human') is deprecated. Please supply `render_mode` when constructing your environment, e.g., gym.make(ID, render_mode='human'). The new `render_mode` keyword argument supports DPI scaling, audio, and native framerates.
Screenshot of the complete error I get is attached here.
My code is given below:
episodes = 5
for episode in range(1, episodes+1):
state = env.reset()
done = False
score = 0
while not done:
env.render()
action = random.choice([0,1,2,3,4,5])
n_state, reward, done, info = env.step(action)
score+=reward
print('Episode:{} Score:{}'.format(episode, score))
env.close()
There is a similar post in stack overflow where in the solution given was:
pip install pyglet==1.2.4
Unfortunately this didn't work for me either.