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.

watching changes raise "RuntimeError: Cannot close a running event loop"

See original GitHub issue
.5/site-packages/apscheduler/executors/pool.py': 1526305704.9472704, '/home/yonghu/wode/myproject/regpark/venv/lib/python3.5/site-packages/flask/cli.py': 1526302662.0420418, '/usr/lib/python3.5/xml/etree/ElementTree.py': 1511887847.0, '/home/yonghu/wode/myproject/regpark/app/models.py': 1526395437.9710488, '/usr/lib/python3.5/asyncio/sslproto.py': 1511887846.0, '/home/yonghu/wode/myproject/regpark/venv/lib/python3.5/site-packages/jinja2/nodes.py': 1526302664.0981076, '/home/yonghu/wode/myproject/regpark/venv/lib/python3.5/site-packages/sqlalchemy/connectors/__init__.py': 1524256070.0})
Traceback (most recent call last):
  File "/home/yonghu/wode/myproject/regpark/venv/lib/python3.5/site-packages/tornado/ioloop.py", line 1208, in _run
    return self.callback()
  File "/home/yonghu/wode/myproject/regpark/venv/lib/python3.5/site-packages/tornado/autoreload.py", line 182, in _reload_on_update
    _check_file(modify_times, path)
  File "/home/yonghu/wode/myproject/regpark/venv/lib/python3.5/site-packages/tornado/autoreload.py", line 197, in _check_file
    _reload()
  File "/home/yonghu/wode/myproject/regpark/venv/lib/python3.5/site-packages/tornado/autoreload.py", line 204, in _reload
    fn()
  File "/home/yonghu/wode/myproject/regpark/venv/lib/python3.5/site-packages/livereload/server.py", line 310, in <lambda>
    add_reload_hook(lambda: IOLoop.instance().close(all_fds=True))
  File "/home/yonghu/wode/myproject/regpark/venv/lib/python3.5/site-packages/tornado/platform/asyncio.py", line 65, in close
    self.asyncio_loop.close()
  File "/usr/lib/python3.5/asyncio/unix_events.py", line 56, in close
    super().close()
  File "/usr/lib/python3.5/asyncio/selector_events.py", line 94, in close
    raise RuntimeError("Cannot close a running event loop")
RuntimeError: Cannot close a running event loop

--------------------------------above is error, follow is code------------------------------------------

@manager.command
def dev():
    from livereload import Server
    live_server = Server(app.wsgi_app)
    live_server.watch('**/*.*')
    live_server.serve(open_url=False)

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

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:4
  • Comments:14 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
frozenpandamancommented, Dec 4, 2020

This seem to still be an issue. Any resolution?

6reactions
AlJohricommented, May 21, 2018

@lilin3 downgrading to 2.5.1 fixes the issue for me. @lepture looks like some regression in the latest release?

Read more comments on GitHub >

github_iconTop Results From Across the Web

RuntimeError: Cannot close a running event loop
When dealing with a task, run_until_complete finishing means that the coroutine has finished as well, having either returned a value or raised ......
Read more >
Jupyter Bot Cannot Close A Running Event Loop, Asyncio Not ...
Hi all. I'm new to discord botting, and trying to run one out of a Jupyter notebook. I'm trying to run the following...
Read more >
cannot close a running event loop - You.com | The AI Search ...
To answer the question as originally stated, there is no need to close() a running loop, you can reuse the same loop for...
Read more >
Event Loop — Python 3.11.1 documentation
Raise a RuntimeError if there is no running event loop. This function can only be called from a coroutine or a callback. New...
Read more >
18.5.1. Base Event Loop — Python 3.6.1 documentation
If stop() is called while run_forever() is running, this will run the current batch of ... Raise RuntimeError if there is a problem...
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