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

Crashes after a short period of time #54

Closed
04fsnape opened this issue Jun 18, 2018 · 15 comments
Closed

Crashes after a short period of time #54

04fsnape opened this issue Jun 18, 2018 · 15 comments

Comments

@04fsnape
Copy link

04fsnape commented Jun 18, 2018

Sorry for all the issues but I'm just trying to get a simple GUI up and running but I'm having quite a lot of problems.

My current GUI consists of 3 .html documents and 4 .css files (one global and three individual).

When I open my GUI it works fine at the start, I can click on each item of my menu and it switches between the html documents great. However, if I start clicking on the links in fairly quick succession the program crashes with no error in the console, but the error on the GUI is

localhost refused to connect

Even if I don't click very fast, the python script will end, but I can still click around for a while (it's very slow), I presume this is because it's cached or something, and then it will run into the same error as before.

Has anyone else experienced issues like this? My code is not very complicated.

Here is my python:

import eel
eel.init('web')
eel.start('settings.html', size=(1216, 736))

And my HTML on all 3 is literally just a menu with links at the moment and the CSS is just simple styling.

EDIT: I have no such problems if I go to localhost in my browser.

@ChrisKnott
Copy link
Collaborator

No need to apologize, thanks for raising issues rather than just moving on.

I will try and recreate your problems tomorrow (England are playing this evening!). You don't look like you are doing anything wrong. I think the best bet will be to add a debug mode with more logging, that should help work out what's happening.

@04fsnape
Copy link
Author

@ChrisKnott I'm wondering if perhaps it is a problem with Chrome Canary as my app seems to run in that my default, not sure how to make it run in normal chrome.

@04fsnape
Copy link
Author

04fsnape commented Jun 18, 2018

After uninstalling Canary, the problem still persists and the dimensions have changed to 1216x739.

@ChrisKnott
Copy link
Collaborator

@04fsnape Can you upload your project somewhere so I can try and recreate the issue?

@04fsnape
Copy link
Author

@ChrisKnott Sure, take a look at https://github.com/04fsnape/eel_test. If you open it and then just click between the pages via the menu on the left a bit you should see it crash.

@ChrisKnott
Copy link
Collaborator

ChrisKnott commented Jun 19, 2018

@04fsnape I think the issue was that it was occasionally taking longer than 1 second to re-establish the websocket for the new page. The default behaviour when a websocket closes is wait 1 second, then see if there are any websockets open, and if there aren't, exit the Python process.

In the latest version, this can be overridden by providing a callback function to init().

Here's an example which doesn't crash for me...

import eel

def on_close(page, sockets):
	print(page, 'closed')
	print('Still have sockets open to', sockets)

web_options = {
	"mode": "chrome-app",
	"host": "localhost",
	"port": 8000,
}
eel.init('web')
eel.start('settings.html', size=(1216, 739), options=web_options, callback=on_close)

Unfortunately this version also doesn't quit. It's up to you to come up with new logic for when you want to quit. One option would be to set a variable changing_page to true when the user clicks a button, wait till that call completes, then change the page. In the quit callback, only exit the Python process if changing_page is False.

Looking at your app though (which looks great!), it might be better to just keep a single page open the whole time, with a single websocket, and use AJAX to dynamically change the contents of the right hand side.

I'll close the issue, but let me know if you are still having problems

@04fsnape
Copy link
Author

@ChrisKnott

I see. Thank you for putting the time in to have a look at the problem.

Do you know if it's possible to tie the function to the close button on the title bar? Because if that is possible then it would work fine as far as I can tell.

If not then I think you're right, AJAX sounds like a good solution.

@ChrisKnott
Copy link
Collaborator

Currently there's not an easy way to do that. I will add some logic to track the actual processes as well later this week which will make this possible

@ChrisKnott
Copy link
Collaborator

I remember know that's it's very difficult to track processes because Chrome is very flexible with how is uses process among different tabs/different windows etc.

@PolyviosP
Copy link

PolyviosP commented Feb 13, 2020

i have problem with ERR_CONNECTION_REFUSED i have trying every example but none of them work
here is my code

import eel
web_options = {"host": "127.0.0.1", 'port': 8000}

eel.init(web)
eel.start('lindex.html', size=(1100, 650), options = web_options, suppress_error=True)

@ilkerx
Copy link

ilkerx commented May 6, 2020

The same here

@munabedan
Copy link

I found that my app was crashing while moving from one page to another, including the eel library to each page seemed to fix the problem:

<script type="text/javascript" src="/eel.js"></script>

I then navigate with:

    window.location.href="newpage.html"

Hope this works for you too

@ilkerx
Copy link

ilkerx commented May 7, 2020

My problem is not while navigating to another page (maybe a sort of). When Chrome DevTools is open, i do Shift + F5 (without changing the main resources, just to refresh) it crashes. This suituation is happening randomly. Sometimes it crashes and sometimes (even after i repetadely Shift + F5) it doesn't.

I'm creating an important application with this and i'm afraid. I need urgent help.

@NarutoOp
Copy link

@munabedan Mun
Thanks this solved my problem.
I also included eel library to each pages and boom it started working smoothly without crashes.

@ilkerx
Copy link

ilkerx commented May 12, 2020

My problem remains with this situation: I have my main html code in "web" folder and i'm changing contents of tag with remote ajax. Adding some external javascript files (from web) dynamically.

It doesn't crash all the time, crashes randomly when i press SHIFT + F5.

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

6 participants