-
-
Notifications
You must be signed in to change notification settings - Fork 149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
watching changes raise "RuntimeError: Cannot close a running event loop" #170
Comments
ahhh, yes - I'm getting the same thing but it used to work perfectly fine before
see this related issue: tornadoweb/tornado#1543 |
this seems like the PR that tries to close the event loop: #157 cc @wewearglasses |
Reverting to 2.5.1 fixed this for me while trying to run a Flask server with livereload. |
Is this still an issue? |
Having the same issue, livereload version
Can confirm, works on this version. Didn't try other versions (apart from the latest LogsOutput of
|
This seem to still be an issue. Any resolution? |
I dug into this issue yesterday a little and can confirm that @AlJohri is correct: 26b1d85 is indeed the cause. I'm not a Tornado or event loops in general expert but the docs state that
I tried calling def close_loop():
IOLoop.instance().stop()
IOLoop.instance().close(all_fds=True)
add_reload_hook(close_loop)
IOLoop.instance().start() but that didn't work as Removing I'm not sure whether this leaves dangling |
Hi @ndkv , if you are using python 3, the reload hook is not needed. I added that line of code in the paste when I was using python 2. |
Yes, I'm on Python 3. Do you know if it is still needed for Python 2? Can we somehow fix this issue for Python 2 and 3? |
I can confirm that this is still an issue for me as well. Just freshly installed livereload for my Django project and am getting the same error. |
It is also affecting me on a Flask project. |
Versions 2.5.2+ have this issue. Downgrade to version 2.5.1 ( |
Latest still has this issue. Haven't had a chance to dig deep but this worked for me. |
It indeed does not show the error, but it also does not reload the browser tab. |
fix(#170): wait for the IOLoop to stop before attempting to close it
I think this can be closed, since #276 has been merged. 🥳 Now we just need a release. |
+1 that #276 fixes this for me whereas when using I updated my project to use the tip of # pyproject.toml
livereload = { git = "https://github.com/lepture/python-livereload.git", branch = "master" } And livereload now functions as expected. My development script: from app import app
from livereload import Server
app.debug = True
server = Server(app.wsgi_app)
if __name__ == "__main__":
server.watch("app/static/dist/styles.css") # this is changed by tailwind compiler
server.serve() |
|
--------------------------------above is error, follow is code------------------------------------------
the project is copied from another ubuntu computer, and is running correctly in another computer, almost everything is same between two computers, thanks for help
The text was updated successfully, but these errors were encountered: