Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
SagarDeka-2299 opened this issue Dec 15, 2024 · 0 comments

Comments

@SagarDeka-2299
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant