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

Error when iterating on episode_data.env_actions if game_over #129

Closed
marota opened this issue Jul 17, 2020 · 0 comments · Fixed by #139
Closed

Error when iterating on episode_data.env_actions if game_over #129

marota opened this issue Jul 17, 2020 · 0 comments · Fixed by #139
Labels
bug Something isn't working

Comments

@marota
Copy link
Contributor

marota commented Jul 17, 2020

Environment

  • Grid2op version: 1.1.1
  • System: osx
  • Additional system information

Bug description

Not able to iterate properly on env.actions from episode_data when a game over happens before the end of a scenario

How to reproduce

redispatching-baseline.zip

path_agent_results=path_to_redispatching-baseline
ScenarioName='000'
episode_data=EpisodeData.from_disk(path_agent_results, ScenarioName)
print(episode_data.env_actions._game_over)
print(len(episode_data.env_actions))

[action for action in episode_data.env_actions]
error:
---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
<ipython-input-22-cf516445d9a4> in <module>
----> 1 [action for action in episode_data.env_actions]

<ipython-input-22-cf516445d9a4> in <listcomp>(.0)
----> 1 [action for action in episode_data.env_actions]

~/dev/ExpertOp4Grid/venv_expert4grid/lib/python3.6/site-packages/grid2op/Episode/EpisodeData.py in __next__(self)
    498         self.i = self.i + 1
    499         if self.i < len(self) + 1:
--> 500             return self.objects[self.i - 1]
    501         else:
    502             raise StopIteration

IndexError: list index out of range

Notice:
it works fine if you set

episode_data.env_actions._game_over=34 #instead of 35
[action for action in episode_data.env_actions]
@marota marota added the bug Something isn't working label Jul 17, 2020
@BDonnot BDonnot linked a pull request Aug 3, 2020 that will close this issue
mjothy pushed a commit to mjothy/Grid2Op that referenced this issue Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant