Skip to content

Target closed exception on env.close() #6

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

Closed
bwitherspoon opened this issue Dec 22, 2020 · 2 comments
Closed

Target closed exception on env.close() #6

bwitherspoon opened this issue Dec 22, 2020 · 2 comments

Comments

@bwitherspoon
Copy link

Running the example:

from gym_derk.envs import DerkEnv

env = DerkEnv(
  n_arenas=1 # Change to 100 for instance, to run many instances in parallel
)

observation_n = env.reset()

while True:
  # Take random actions each step
  action_n = [env.action_space.sample() for i in range(env.n_agents)]
  observation_n, reward_n, done_n, info_n = env.step(action_n)

  if all(done_n):
    break
env.close()

I get the following exception on env.close():

Traceback (most recent call last):
  File "test.py", line 16, in <module>
    env.close()
  File "/home/spoonb/.conda/envs/derk/lib/python3.8/site-packages/gym_derk/envs/derk_env.py", line 193, in close
    return asyncio.get_event_loop().run_until_complete(self.async_close())
  File "/home/spoonb/.conda/envs/derk/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/spoonb/.conda/envs/derk/lib/python3.8/site-packages/gym_derk/envs/derk_env.py", line 205, in async_close
    await self.running_session
  File "/home/spoonb/.conda/envs/derk/lib/python3.8/site-packages/gym_derk/derk_app_instance.py", line 264, in run_episodes_loop
    await self.page.evaluate('''() => window.derk.session.runEpisodesLoop()''')
  File "/home/spoonb/.conda/envs/derk/lib/python3.8/site-packages/pyppeteer/page.py", line 1184, in evaluate
    return await frame.evaluate(pageFunction, *args, force_expr=force_expr)
  File "/home/spoonb/.conda/envs/derk/lib/python3.8/site-packages/pyppeteer/frame_manager.py", line 308, in evaluate
    return await context.evaluate(
  File "/home/spoonb/.conda/envs/derk/lib/python3.8/site-packages/pyppeteer/execution_context.py", line 53, in evaluate
    handle = await self.evaluateHandle(
  File "/home/spoonb/.conda/envs/derk/lib/python3.8/site-packages/pyppeteer/execution_context.py", line 108, in evaluateHandle
    _rewriteError(e)
  File "/home/spoonb/.conda/envs/derk/lib/python3.8/site-packages/pyppeteer/execution_context.py", line 238, in _rewriteError
    raise error
  File "/home/spoonb/.conda/envs/derk/lib/python3.8/site-packages/pyppeteer/execution_context.py", line 99, in evaluateHandle
    _obj = await self._client.send('Runtime.callFunctionOn', {
pyppeteer.errors.NetworkError: Protocol error Runtime.callFunctionOn: Target closed.
@FredrikNoren
Copy link
Contributor

@bwitherspoon Thanks for reporting. From what I can tell, everything should still be working fine, this is just a "cosmetic" error on the env.close call (i.e. everything should still work fine). I'll look into fixing it.

@FredrikNoren
Copy link
Contributor

Ok, this is now fixed in 0.15.6

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

2 participants