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

enable_render #20

Open
jekahamster opened this issue Oct 9, 2023 · 1 comment · May be fixed by #21
Open

enable_render #20

jekahamster opened this issue Oct 9, 2023 · 1 comment · May be fixed by #21

Comments

@jekahamster
Copy link

I see you provide the option to disable rendering, which is useful when working with Jupyter notebooks. However, if you try to do that, you will find that there is a serious bug in the code that prevents this feature:

import gym_maze
gym.envs.registration.register(
    id="maze-sample-5x5-v0-no-render",
    entry_point="gym_maze.envs:MazeEnvSample5x5",
    max_episode_steps=2000,
    kwargs={
        "enable_render": False
    }
)
env = gym.make("maze-sample-5x5-v0-no-render")
obs, info = env.reset()
img = env.render(mode="rgb_array")     # AttributeError: 'MazeView2D' object has no attribute 'screen'

The issue is that you create the 'screen' field only when 'enable_render' is set to 'True,' but the '__view_update(self, mode)' method is called at all times, and it uses the 'screen' field internally.

Path: gym_maze > envs > MazeView2D > init
image

Path: gym_maze > envs > MazeView2D > __view_update
image

Path: gym_maze > envs > MazeView2D > update
image

@JupiLogy JupiLogy linked a pull request Oct 9, 2023 that will close this issue
@JupiLogy
Copy link

JupiLogy commented Oct 9, 2023

Hey, I've made a pull request but since this repo is basically inactive it is unlikely to get accepted. However, the code with the fix is available on my profile. Good luck!

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

Successfully merging a pull request may close this issue.

2 participants