Eel icon indicating copy to clipboard operation
Eel copied to clipboard

browser pops up before server is properly initialized

Open WhimsicalWhale opened this issue 3 years ago • 3 comments

I'm attempting to get a currently existing eel project to work on RHEL 8. I'm using python3.8 to run the GUI, and just installed eel via pip. When I start the program, it pops open a browser that gives an error that it cannot connect to the server. If I wait a couple seconds, I can refresh the page and the program works as expected from there.

As for a code snippet, I'm not entirely sure where the relevant parts would be, so here's where I initialize and launch the program. If you can point me in a better direction, I'd love to hear it.

# I promise I have the relevant imports...
if __name__ == '__main__':
    multiprocessing.freeze_support()
    print(eel._get_real_path('GUI/web'))
    eel.init('GUI/web')
    eel.start('main.html', size=(1366, 780), port=9999, cmdline_args=['--allow-file-access-from-files', os.getcwd()], mode='default')

Desktop:

  • OS: RHEL8
  • Browser: firefox
  • Version: 91.5.0esr

WhimsicalWhale avatar Jan 19 '22 20:01 WhimsicalWhale

As an update, I did more researched and asked around to others I know who have used eel in the past, and it looks like a temporary solution to my problem is require users have Chrome or Chromium installed and allow eel to use the default behavior of opening in app mode with Chrome or Chromium. However, I don't think this is an ideal solution, as a Chromium install is a rather large requirement for the sort of program I'm writing. Is there a setting I'm missing that I could use, or is this something that I'll have to deal with when using eel?

WhimsicalWhale avatar Jan 20 '22 21:01 WhimsicalWhale

I believe you can check for other browsers before defaulting to chrome.

eddyizm avatar Jan 29 '22 15:01 eddyizm

You are correct and that is what I ended up doing, but it still leaves the problem of the browser popping up before the server is ready if the user doesn't have chrome installed.

WhimsicalWhale avatar Jan 29 '22 20:01 WhimsicalWhale