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

can't get example code from documentation to run #23

Open
pthornton614 opened this issue Jun 5, 2021 · 0 comments
Open

can't get example code from documentation to run #23

pthornton614 opened this issue Jun 5, 2021 · 0 comments

Comments

@pthornton614
Copy link

pthornton614 commented Jun 5, 2021

Installed the library, was able to run the single player one liner. Tried making a py file with the example code, and getting the error below.

Example code, ive named testGym.py:
GNU nano 4.8 testGym.py
from nes_py.wrappers import JoypadSpace
import gym_tetris
from gym_tetris.actions import MOVEMENT

env = gym_tetris.make('Tetris-v0')
env = JoypadSpace(env, 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 i receive:

(base) peter@peter-VirtualBox:~/TetrisAIProject$ python testGym.py
Traceback (most recent call last):
File "/home/peter/conda3/lib/python3.7/site-packages/gym/envs/registration.py", line 121, in spec
return self.env_specs[id]
KeyError: 'Tetris-v0'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "testGym.py", line 5, in
env = gym_tetris.make('Tetris-v0')
File "/home/peter/conda3/lib/python3.7/site-packages/gym/envs/registration.py", line 145, in make
return registry.make(id, **kwargs)
File "/home/peter/conda3/lib/python3.7/site-packages/gym/envs/registration.py", line 89, in make
spec = self.spec(path)
File "/home/peter/conda3/lib/python3.7/site-packages/gym/envs/registration.py", line 131, in spec
raise error.UnregisteredEnv('No registered env with id: {}'.format(id))
gym.error.UnregisteredEnv: No registered env with id: Tetris-v0
(base) peter@peter-VirtualBox:~/TetrisAIProject$ testGym.py
testGym.py: command not found

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