With block=False and reading from sys.stdin, localhost doens't connect
Eel version 0.14.0
Describe the bug Running eel in non blocking mode, then reading from sys.stdin in a loop causes a localhost failed to connect in chrome.
** what happens **

To Reproduce Steps to reproduce the behavior:
- create some web folder with a dummy index.html file
<!doctype html>
<html>
<head></head>
<body>
<div id="container">
<svg id="drawing"></svg>
</div>
<script src="https://d3js.org/d3.v6.min.js"></script>
<script type="text/javascript" src="/eel.js"></script>
<script src="index.js"></script>
</body>
</html>
- put this in a python file
import eel
import sys
eel.init('web')
eel.start('index.html', block=False)
while True:
for l in sys.stdin:
eel.draw([['x', 1, random.random()*500, random.random()* 500]])
- put this in a js file
eel.expose(draw)
function draw(to_draw) {
d3.select('svg#drawing').selectAll('text')
.data(to_draw).attr('x', d => d[2]).attr('y', d => d[3]).text(d => d[0])
.enter().append('text').attr('x', d => d[2]).attr('y', d => d[3]).text(d => d[0])
.exit().remove()
}
Expected behavior App should open as normal and display results of drawing a random x every second.
Desktop (please complete the following information):
- OS: [e.g. iOS] MacOS 10.13
- Browser [e.g. chrome, safari] chrome 86
Additional context Doing something non sys.stdin related in the while True loop works just fine, like
while True:
eel.draw([['x', 1, random.random()*500, random.random()*500]])
eel.sleep(0.2)
I have the same issue. I guess when the io-related blocking happens, it prevents the server from running properly.
I'm having the exact same problem. I'm using a simple hello world eel project. When adding block=False, eel can no longer connect. It's super frustrating.
Same problem here, although I don't use io things
Some issue here.
Same here. As a workaround you can launch eel in a thread
import threading
import eel
def start_gui():
eel.init ('gui')
eel.start ('index.html')
gui_thread = threading.Thread (target=start_gui)
gui_thread.daemon = True
gui_thread.start()
# do other stuff