Setting block=False at eel.start() gives error
See original GitHub issueEel version 0.14.0
Describe the bug
When the app is started with block=False,
It gives the error as Error site can't be reached
Issue similar to this one: #167
To Reproduce
Steps to reproduce the behavior:
try to start the app with eel.start("index.html",block=True)
As show in the code snippet below:
import pyautogui
import eel
import datetime
import time
eel.init('front-end')
#--------------------------------------------------------------------------
#Problematic line
eel.start('index.html',size=(500,500),block=False)
#this works fine as long as it is started without the block=False
#--------------------------------------------------------------------------
@eel.expose
def handshake(secs):
secs=float(secs)
while secs:
eel.sleep(1)
pyautogui.press('f15')
print(f"Time: {datetime.timedelta(seconds=float(secs))}")
return f"Time: {datetime.timedelta(seconds=float(secs))}"
Expected behavior The app should work normally but it gives LocalHost error
Screenshots
Desktop (please complete the following information):
- OS: windows 11
- Browser Google Chrome
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Blocking False is not working · Issue #477 · python-eel/Eel
Open up python and call the eel.init("web") function · Then call the eel.start("index.html", blocking=false) · Click on reload (F5) or open the ...
Read more >python eel - and 404 when block=False - Stack Overflow
It gives me a 404 error. But when I start eel with this basic pattern: eel.start("index_blank.html"). it will work. When I use block=False ......
Read more >How to use the eel.init function in Eel - Snyk
To help you get started, we've selected a few eel.init examples, ... return random.random() eel.start('sync_callbacks.html', block=False, size=(400, ...
Read more >Python GUI Using Chrome - Nitratine
start(). If you want to execute code underneath eel.start() you can pass block=False as an argument to stop it from blocking. For ...
Read more >Eel - Bountysource
Describe the bug. When the app is started with block=False, It gives the error as Error site can't be reached. Issue similar to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @thatfloflo. Thank you for sharing your solution. For me, it worked but only for the first time I ran my code. After that, localhost would be refused again. But you gave me the ideia to use
eel.sleep(1.0)
just aftereel.start
being called. I am not sure about the 1.0, but this way it started to work, at least for me. Worth trying.Update: nah, this just makes it load the html, but JS is still not loaded, no matter what time interval I choose to
eel.sleep
. Does anyone have any tip? I really need to get this working soon…I suspect your script might just finish and quit before you ever get around to connecting. Try something like this:
If you don’t have eel block then you need to make sure the event loop is entered yourself as far as I can tell. This also leaves it up to you to quit the event loop when the last socket is closed (or whatever conditions/events happen that should produce that behaviour).