question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

block=False gives me "ERR_CONNECTION_REFUSED"

See original GitHub issue

** block=False gives me “ERR_CONNECTION_REFUSED”** I want to call JS function from python but i get “ERR_CONNECTION_REFUSED” error whenever i use “block=False”

Python Backend

import eel


eel.init("web")  


@eel.expose    
def on_load():
    print("Application running")

eel.start(
    'index.html', 
    block=False,
    mode="chrome"
    )


while True:
    returned_value = input("Send message to frontend: ")
    eel.pythonMessage(returned_value)

JavaScript Part

function pythonMessage(message) {
  console.log(message);
}
eel.expose(pythonMessage);
  • I know that if I don’t provide sample code that allows someone to quickly step into my shoes, I may not get the help I want or my issue may be closed.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Chrome
  • Version Latest Eel and Chrome V10

chrome_UOMikzIG5M 0

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Gabriel11101commented, Jul 12, 2022

I figured it out!

The only difference is here…

import eel


eel.init("web")  


@eel.expose    
def on_load():
    print("Application running")

eel.start(
    'index.html', 
    block=False,
    mode="chrome"
    )


while True:
    eel.sleep(1) # I really don't know why this works but it works 💯 
    returned_value = input("Send message to frontend: ")
    eel.pythonMessage(returned_value)

I am glad that i find some sort of solution, can anyone has a proper answer why it doesn’t work without sleep method and why works now?

Thank you so much! I didn’t want to create a new thread and your solution works perfectly.

1reaction
SuperZombicommented, Jul 11, 2022

@vimevim

I am glad that i find some sort of solution, can anyone has a proper answer why it doesn’t work without sleep method and why works now?

Its magic)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix the ERR_CONNECTION_REFUSED Error in Chrome
The ERR_CONNECTION_REFUSED error is sometimes caused by a server-side problem, rather than an issue with your individual attempt at connection.
Read more >
ERR_CONNECTION_REFUSED: What It Is and 11 Ways to Fix It
There can be a variety of causes, such as incorrect proxy configuration, caching errors, or the web server blocking the proxy and the...
Read more >
How to Fix ERR_CONNECTION_REFUSED Error in Chrome?
The ERR_CONNECTION_REFUSED error message appears on Google Chrome when the user tries to search for something on the browser and the browser ...
Read more >
How to Fix the ERR_CONNECTION_REFUSED Error in Chrome
9 Simple Ways to Fix the ERR_CONNECTION_REFUSED Error in Chrome · Solution 1: Check the Website Status · Solution 2: Restart Your Router...
Read more >
ERR_CONNECTION_REFUSED | How to fix the error - IONOS
The ERR_CONNECTION_REFUSED error is a client-side problem that can be caused by incorrect firewall, system or browser settings, but also by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found