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

'HumanRendering' object has no attribute 'window' (#1078) #1079

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

RogerJL
Copy link
Contributor

@RogerJL RogerJL commented Jun 8, 2024

Description

Place initialization before asserts to avoid exit/close code to access uninitialized instance variables.

Fixes # (1078)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I have run the pre-commit checks with pre-commit run --all-files (see CONTRIBUTING.md instructions to set it up)
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

@RedTachyon
Copy link
Member

Can you add tests showing the bug, that would fail on current main branch, and pass with this fix?

@RogerJL
Copy link
Contributor Author

RogerJL commented Jun 10, 2024

The bug is automatically ignored. But if you look in the logs you get very confused...
Take this as an example - main (3.12 shown)

https://github.com/Farama-Foundation/Gymnasium/actions/runs/9422643271/job/25959372466

tests/wrappers/vector/test_human_rendering.py::test_render_modes
  /usr/local/lib/python3.12/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function VectorEnv.__del__ at 0x7f7f7083f9c0>
  
  Traceback (most recent call last):
    File "/usr/local/gymnasium/gymnasium/vector/vector_env.py", line 324, in __del__
      self.close()
    File "/usr/local/gymnasium/gymnasium/wrappers/vector/rendering.py", line 178, in close
      if self.window is not None:
         ^^^^^^^^^^^
  AttributeError: 'HumanRendering' object has no attribute 'window'
  
    warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))

Copy link
Member

@pseudo-rnd-thoughts pseudo-rnd-thoughts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR

@pseudo-rnd-thoughts pseudo-rnd-thoughts merged commit b58207f into Farama-Foundation:main Jun 10, 2024
9 checks passed
@RogerJL RogerJL deleted the nowindow branch June 10, 2024 16:03
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 this pull request may close these issues.

3 participants