Skip to content

Using render_browser when the env.render() is on an external function #2

@ValerioB88

Description

@ValerioB88

Hi. First of all, thank you for the script, amazingly useful!
I was wondering if there is a way to use it when env.render is somewhere else than the main function. For example

@render_browser
def external_env(env):
    yield env.render(mode='rgb_array')
    obs, rew, done, _ = env.step(env.action_space.sample())
    if done:
        env.reset()

def test_policy():
    env = gym.make('Breakout-v0')
    obs = env.reset()
    counter = 0
    while True:
        external_env(env)
        print(f"COUNTER: {counter}")  # this doesn't get called

test_policy()

The function seems to send one step through the browser and then stops.
Any idea?

Thanks!

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