Skip to content
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

RuntimeError: Cannot close a running event loop #176

Closed
guomaoqiu opened this issue Aug 22, 2018 · 5 comments
Closed

RuntimeError: Cannot close a running event loop #176

guomaoqiu opened this issue Aug 22, 2018 · 5 comments

Comments

@guomaoqiu
Copy link

- Error:
Traceback (most recent call last):
File "/Users/Green/py36/lib/python3.6/site-packages/tornado/ioloop.py", line 1229, in _run
return self.callback()
File "/Users/Green/py36/lib/python3.6/site-packages/tornado/autoreload.py", line 185, in _reload_on_update
_check_file(modify_times, path)
File "/Users/Green/py36/lib/python3.6/site-packages/tornado/autoreload.py", line 200, in _check_file
_reload()
File "/Users/Green/py36/lib/python3.6/site-packages/tornado/autoreload.py", line 207, in _reload
fn()
File "/Users/Green/py36/lib/python3.6/site-packages/livereload/server.py", line 310, in
add_reload_hook(lambda: IOLoop.instance().close(all_fds=True))
File "/Users/Green/py36/lib/python3.6/site-packages/tornado/platform/asyncio.py", line 71, in close
self.asyncio_loop.close()
File "/Users/Green/.pyenv/versions/3.6.0/lib/python3.6/asyncio/unix_events.py", line 63, in close
super().close()
File "/Users/Green/.pyenv/versions/3.6.0/lib/python3.6/asyncio/selector_events.py", line 107, in close
raise RuntimeError("Cannot close a running event loop")
RuntimeError: Cannot close a running event loop

- Run ENV:
python 3.6
livereload: 2.5.2

my flask app manager settings:

@manager.command
def dev():
live_server = Server(app.wsgi_app)
live_server.watch('/')
live_server.serve(open_url=False,port=5000,debug=True)

When I press ctrl+c to save the file, terminal reports an error.
My app is running as :
~/py36/bin/python manager.py dev

please help me thanks.

@cmbasnett
Copy link

You may need to downgrade to 2.5.1: #170

@kariavka
Copy link

kariavka commented Feb 18, 2019

@cmbasnett ❤❤❤

Thank you! That was so helpfull!

@d1618033
Copy link

d1618033 commented Jan 2, 2020

I get the same bug.

It seems that in tornado they decided to remove the ioloop.close because it's unneeded in python 3.4+.
A few months later, the ioloop.close was added to python-livereload. This is what caused the aforementioned bug to occur.

@EpicCodeWizard
Copy link

Versions 2.5.2+ have this issue. Downgrade to version 2.5.1 (pip install livereload==2.5.1).

@rpaladin
Copy link

I downgraded to 2.5.1 as suggested, but then I get the error mentioned in #209.

What is the proposed solution if we're not allowed to use later versions and past versions are broken or incompatible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants