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.

Change / refresh / close page?

See original GitHub issue

Hi! Thank you a lot for your work on Eel. I’m wondering if there is a way to open, re-open, or refresh the html page in the very same window? Unfortunately, I couldn’t find this information.

I’m using Jinja2 templates for different views. As the program runs, the rendered templates are saved under the same name (index.html) and then should to be re-opened. However, doing ee.start("index.html") for the second time opens a new window beside the previous one. To add to this, the following OSError appears in the process:

OSError: [WinError 10048] Only one usage of each socket address (protocol/network address/port) is normally permitted: ('localhost', 8000)
2018-05-22T20:00:29Z <Greenlet "Greenlet-0" at 0x1ece5058a48: _process_message({'call': 1.5296098246811638, 'name': 'select_new_t, <geventwebsocket.websocket.WebSocket object at 0x0)> failed with OSError

but actually does not seem to affect the program’s functionality.

In case if opening another html page in the same window or refreshing it is not possible, is there a way to simply close the old window?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:16

github_iconTop GitHub Comments

4reactions
revliscanocommented, Mar 24, 2020

Hello! Thanks a lot for inventing Eel. It’s truly wonderful. I was getting a lot of errors when changing pages. I managed to make everything work as expected by doing some changes to eel.init.py file.

In case anyone needs it, please give it a try. If someone spot something wrong that might be with it, please also share it.

All I did was to move away the _websockets.remove((page, ws)) call from _websocket(ws) to _websocket_close function and slightly modify a couple more of thing in the latter function. Just as follows:

  • note that I set _websocket_close to accept one additional parameter now.
def _websocket_close(page, ws):
    if _on_close_callback is not None:
        sockets = [p for _, p in _websockets]
        _on_close_callback(page, sockets)
    else:
        sleep(5.0)
        _websockets.remove((page, ws))
        if len(_websockets) == 0:
            sys.exit()
0reactions
khoidtcommented, Jun 19, 2018

@ChrisKnott, thank you! I’m going to use this feature in my next Eel script.

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Ways to Refresh a Page - wikiHow
Windows — Press Ctrl + F5 . If that doesn't work, hold down Ctrl and click the "Refresh" icon. Mac — Press ⌘ ......
Read more >
Simple steps to refresh your web browser cache
Simply, On windows Press Ctrl+F5 and On Mac press Option+⌘ Command+E to empty your cache, and then ⌘ Command+R to refresh the page....
Read more >
Open popup and refresh parent page on close popup
I opened a popup window by window.open in JavaScript, I want to refresh parent page when I close this popup window.(onclose event?) how...
Read more >
How to know a browser tab close or refresh with JavaScript
1. onbeforeunload. onbeforeunload event trigger when tries to close, refresh the tab or closing the Browser. You can use this to display an ......
Read more >
Change / refresh / close page? · Issue #44 · python-eel/Eel
Hi! Thank you a lot for your work on Eel. I'm wondering if there is a way to open, re-open, or refresh the...
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