Skip to content

使用gym-super-mario-bros 7.4.0官方例程运行报错 #90

@Mosazh

Description

@Mosazh

使用gym-super-mario-bros 7.4.0官方例程运行报错

环境:

  1. python 3.8.18
  2. nes-py 8.2.1
  3. gym-super-mario-bros 7.4.0
  4. 使用vs code Jupyter插件运行
from nes_py.wrappers import JoypadSpace
import gym_super_mario_bros
from gym_super_mario_bros.actions import SIMPLE_MOVEMENT
env = gym_super_mario_bros.make('SuperMarioBros-v0')
env = JoypadSpace(env, SIMPLE_MOVEMENT)

done = True
for step in range(5000):
    if done:
        state = env.reset()
    state, reward, done, info = env.step(env.action_space.sample())
    env.render()

env.close()

报错提示:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
Cell In[10], line 11
      9     if done:
     10         state = env.reset()
---> 11     state, reward, done, info = env.step(env.action_space.sample())
     12     env.render()
     14 env.close()

File d:\software\anaconda3\envs\RLE2\lib\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 d:\software\anaconda3\envs\RLE2\lib\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)

请问是哪里出现问题呢?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions