Closed brucecui1998 closed 1 year ago
Please see https://github.com/Farama-Foundation/Gymnasium/issues/77
from nes_py.wrappers import JoypadSpace
import gym_super_mario_bros
from gym_super_mario_bros.actions import SIMPLE_MOVEMENT
import gym
env = gym.make('SuperMarioBros-v0', apply_api_compatibility=True, render_mode="human")
env = JoypadSpace(env, SIMPLE_MOVEMENT)
done = True
env.reset()
for step in range(5000):
action = env.action_space.sample()
obs, reward, terminated, truncated, info = env.step(action)
done = terminated or truncated
if done:
env.reset()
env.close()
Describe the bug
When setting up my envs, I get Value Error messages for my env.step(env.action_space.sample()) If you can help that will be greatly appreciated! (Mac OS, Jupyter Lab)
Here's the Code:
Code example
System info
pip3 install gym-super-mario-bros==7.3.0 nes_py gymnasium.version = 0.26.3 python==3.7.0
Additional context
Error Message: ValueError Traceback (most recent call last) Cell In [45], line 5 3 if done: 4 state = env.reset() ----> 5 state, reward, done, info = env.step(env.action_space.sample()) 6 env.render() 8 env.close()
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/nes_py/wrappers/joypad_space.py:74, in JoypadSpace.step(self, action) 59 """ 60 Take a step using the given action. 61 (...) 71 72 """ 73 # take the step and record the output ---> 74 return self.env.step(self._action_map[action])
File /Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/gym/wrappers/time_limit.py:50, in TimeLimit.step(self, action) 39 def step(self, action): 40 """Steps through the environment and if the number of steps elapsed exceeds max_episode_steps then truncate. 41 42 Args: (...) 48 49 """ ---> 50 observation, reward, terminated, truncated, info = self.env.step(action) 51 self._elapsed_steps += 1 53 if self._elapsed_steps >= self._max_episode_steps:
ValueError: not enough values to unpack (expected 5, got 4)
Checklist