Skip to content

Not able to preview the game after installing the latest versions using pip. #134

@SagarDeka-2299

Description

@SagarDeka-2299

I installed the following:
pip install gym_super_mario_bros nes_py gym 0.26.2
gym-super-mario-bros 7.4.0

code:

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()

error:

ValueError Traceback (most recent call last)
Cell In[13], line 10
8 random_action=env.action_space.sample()
9 print(random_action)
---> 10 stepop=env.step(random_action)
11 print(stepop)
12 #show on the screen = only work in jupyternotebook in local machine
File /opt/anaconda3/lib/python3.12/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 /opt/anaconda3/lib/python3.12/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:
(...)
...
---> 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