-
-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle text browsers explicitly to support unlisted GUI browsers (#724)
* Handle text browsers explicitly to support unlisted GUI browsers Ref: #723 * Handle not finding a browser at all gracefully
- Loading branch information
1 parent
31d3e12
commit aeace79
Showing
3 changed files
with
22 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
def find_browser(): | ||
"""Find the default browser if possible and if compatible.""" | ||
import webbrowser | ||
|
||
# Mostly taken from the standard library webbrowser module. Search "console browsers" in there. | ||
# In general, a browser belongs on this list of the scalene web GUI doesn't work in it. | ||
# See https://github.com/plasma-umass/scalene/issues/723. | ||
incompatible_browsers = {"www-browser", "links", "elinks", "lynx", "w3m", "links2", "links-g"} | ||
|
||
try: | ||
browser = webbrowser.get() | ||
except webbrowser.Error: | ||
return None | ||
|
||
return None if browser.name in incompatible_browsers else browser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters