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

[BUG] Editor unable to locate browser #74

Open
lilithwhite opened this issue Jun 23, 2021 · 4 comments
Open

[BUG] Editor unable to locate browser #74

lilithwhite opened this issue Jun 23, 2021 · 4 comments
Assignees

Comments

@lilithwhite
Copy link

It seems the editor is unable to find a browser. I have both Firefox and Chromium installed.

On Pop_OS 20.10 I installed python3-tk and installed all the requirements but when running the editor with python3 main.py it gives you the following error:
Following exception occurred:
Traceback (most recent call last):
File "main.py", line 1020, in
run()
File "main.py", line 1003, in run
eel.start("no settings.html", mode="chrome", port=web_app_options["port"],
File "/home/seren/.local/lib/python3.8/site-packages/eel/init.py", line 158, in start
show(*start_urls)
File "/home/seren/.local/lib/python3.8/site-packages/eel/init.py", line 186, in show
brw.open(start_urls, _start_args)
File "/home/seren/.local/lib/python3.8/site-packages/eel/browsers.py", line 65, in open
raise EnvironmentError("Can't find %s installation" % browser_module.name)
OSError: Can't find Google Chrome/Chromium installation

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "main.py", line 1024, in
run()
File "main.py", line 1003, in run
eel.start("no settings.html", mode="chrome", port=web_app_options["port"],
File "/home/seren/.local/lib/python3.8/site-packages/eel/init.py", line 158, in start
show(*start_urls)
File "/home/seren/.local/lib/python3.8/site-packages/eel/init.py", line 186, in show
brw.open(start_urls, _start_args)
File "/home/seren/.local/lib/python3.8/site-packages/eel/browsers.py", line 65, in open
raise EnvironmentError("Can't find %s installation" % browser_module.name)
OSError: Can't find Google Chrome/Chromium installation

Press Enter to close the application

@lilithwhite
Copy link
Author

I bypassed the issue by changing mode values to firefox on lines 997 and 1003 in main.py. Like so:
eel.start("loadsavefile.html", mode="firefox", port=web_app_options["port"],

@NetroScript
Copy link
Owner

This is a problem with the used eel module.
Valid options for the mode parameter are actually only chrome, electron, edge, custom - if you input anything else it starts your default browser.

Chrome is hard coded because it has the best support (considering displaying a browser window like an application and for example also the css zoom property).

Eel uses the following code to find the chrome installation

def _find_chrome_linux():
    import whichcraft as wch
    chrome_names = ['chromium-browser',
                    'chromium',
                    'google-chrome',
                    'google-chrome-stable']

    for name in chrome_names:
        chrome = wch.which(name)
        if chrome is not None:
            return chrome
    return None

So assuming eel identifies Pop OS as linux (sys.platform starting with linux) it seems your Chromium installation isn't on the path - or can you start Chromium using chromium-browser in console?

@lilithwhite
Copy link
Author

Ah, that does explain it: Chromium is installed as a flatpak so eel can't find it. I prefer to use Firefox anyways, I only installed Chromium to test this out.
Shouldn't the editor fall back on your default browser if no chrome based browser is found? It doesn't explicitly say that in the readme but there's no mention that a Chrome based browser is a hard requirement and there's even mention that testing has been done with other browsers.

@NetroScript
Copy link
Owner

I might be wrong, but if I remember correctly, a previous eel version automatically fell back to another browser, if chrome wasn't working, the required eel version of this editor was updated at some point and since then it only tries one browser (the one specified). Maybe an idea for advanced users (which are more or less all users which don't download the "precompiled" Windows version) would be a command line option to select the default browser - which gets passed through eel.

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

No branches or pull requests

2 participants