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

Fix open_url_browser function which malfunctions on macOS under Python 3.9 #187

Merged
merged 2 commits into from
Oct 13, 2023

Conversation

jefferyharrell
Copy link
Contributor

On the Mac, under Python 3.9, the method call webbrowser.get().name fails with an OS-level error:

>>> import webbrowser
>>> webbrowser.get().name
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'MacOSXOSAScript' object has no attribute 'name'

This problem goes away under Python 3.11, but I think a better fix would be to remove the call entirely, as on the Mac it just returns "default" and on Windows it returns an empty string. So it's kind of pointless.

This PR removes the webbrowser.get().name call entirely and rewords the docstring and log message text to be generic. Now it works identically on macOS and Windows.

- and arguably isn't really necessary anyway
- This function is called not only to open mod URLs but also the wiki URL.
@jefferyharrell jefferyharrell added the bugs 🪲 bugs and errors, something is not working as intended label Oct 13, 2023
Copy link
Collaborator

@twstagg twstagg left a comment

Choose a reason for hiding this comment

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

Thanks! This is better since it respects the user preference by using open() instead of open_tab() as well.

@twstagg twstagg merged commit f61054c into RimSort:main Oct 13, 2023
@jefferyharrell jefferyharrell deleted the jefferyharrell/open-url-fix branch October 14, 2023 17:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs 🪲 bugs and errors, something is not working as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants