python-eel / Eel

A little Python library for making simple Electron-like HTML/JS GUI apps
MIT License
6.5k stars 592 forks source link

Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist. #601

Open KirigayaKazuto06 opened 2 years ago

KirigayaKazuto06 commented 2 years ago

Hey, I know this issue has probably been dealt with before, however I can't find any proper workarounds to it.

I'm getting this message: Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.

image

when I running my main.py

here's the code:

JS image

Python image

HTML image

and I really confused 'cause everything looks fine...

Any help will be very appreciated in advance.

dstricks commented 2 years ago

You can see a 404 like that if you're not initializing eel (i.e. eel.init(<dir>)) and/or the start page path (i.e. eel.start(<path>)) properly.

I'm curious about line 4 of your main.py because the implementation of eel.init tries to find the absolute path for you and ensure it's properly escaped for your OS, etc.... was there a reason you did it like that instead of eel.init('web')? It's very possible that I'm overlooking something...

What happens when you update line 4 to eel.init('web')?

Also, depending on your OS, the "/" could be the wrong one. os.path.join (or similar from https://docs.python.org/3/library/pathlib.html#correspondence-to-tools-in-the-os-module) can help you out here.