-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[BUG FIX] ext/pyrender/viewer: resolve macOS crashes when initialising Tk() #92
Conversation
try: | ||
from Tkinter import Tk | ||
from Tkinter import tkFileDialog as filedialog | ||
except Exception: | ||
try: | ||
from tkinter import Tk | ||
from tkinter import filedialog as filedialog | ||
except Exception: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The purpose of this code is to ensure compatibility with Tkinter, supporting both Python 2 and Python 3. Genesis requires Python 3.9 or higher, such compatibility adjustments are unnecessary.
Line 12 in 2985aa9
requires-python = ">=3.9" |
@@ -16,6 +16,8 @@ | |||
|
|||
from tkinter import Tk | |||
from tkinter import filedialog | |||
root = Tk() | |||
root.withdraw() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hide root window as we only use filedialog
to save image.
Thank you for this!!!! Could you test and make sure it doesn't interfere with other os? if not we can merge |
I have tested viewer on macOS 15.2 and Ubuntu 22.04 w/ cu118, and it worked as expected. It should also function correctly on Windows, but I don't have a testing platform to confirm this. To test it, run any script containing The use of So I assume it works well across multiple platforms. |
@zhenjia-xu could you take care of this? |
@zhouxian I have made a test on Windows 10 22H2 19045.5247 and it was passed. I believe it's safe to merge, and it shouldn't cause any issues with other supporting os. |
Thank you:) |
Hi, it seems this caused issue on linux via SSH, and pyrender will not be able to be imported (works fine in local terminal, but fails when doing this via ssh) Could you fix this? it seems a bit urgent. |
Oops, apologies for any trouble may caused. [Edit] Here's a ref of how to setup X windows: https://stackoverflow.com/questions/40195740/how-to-run-openai-gym-render-over-a-server/48237220#48237220 Also need: sudo apt install python3-tk |
Ok thanks! |
This PR should resolve Issue#91.
On macOS, a Tk instance should be initiated before creating the viewer.