Skip to content

Instantly share code, notes, and snippets.

@kyrias

kyrias/source.py

Last active Mar 19, 2018
Embed
What would you like to do?
import trio
import trio_asyncio
async def async_main():
async with trio_asyncio.open_loop() as loop:
pass
trio_asyncio.run(async_main)
Traceback (most recent call last):
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio_asyncio/async_.py", line 113, in open_loop
asyncio.set_event_loop(loop)
File "/usr/lib/python3.6/asyncio/events.py", line 699, in set_event_loop
get_event_loop_policy().set_event_loop(loop)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio_asyncio/loop.py", line 100, in set_event_loop
raise RuntimeError('You cannot replace an event loop.')
RuntimeError: You cannot replace an event loop.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "foo.py", line 8, in <module>
trio_asyncio.run(async_main)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio_asyncio/loop.py", line 223, in run
trio.run(_run_task, proc, args)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_run.py", line 1225, in run
return result.unwrap()
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_result.py", line 119, in unwrap
raise self.error
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_run.py", line 1334, in run_impl
msg = task.coro.send(next_send)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_run.py", line 923, in init
self.entry_queue.spawn()
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_util.py", line 109, in __aexit__
await self._agen.asend(None)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/async_generator/_impl.py", line 274, in asend
return await self._do_it(self._it.send, value)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/async_generator/_impl.py", line 290, in _do_it
return await ANextIter(self._it, start_fn, *args)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/async_generator/_impl.py", line 202, in send
return self._invoke(self._it.send, value)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/async_generator/_impl.py", line 209, in _invoke
result = fn(*args)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_run.py", line 318, in open_nursery
await nursery._nested_child_finished(nested_child_exc)
File "/usr/lib/python3.6/contextlib.py", line 99, in __exit__
self.gen.throw(type, value, traceback)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_run.py", line 203, in open_cancel_scope
yield scope
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_multierror.py", line 144, in __exit__
raise filtered_exc
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_run.py", line 203, in open_cancel_scope
yield scope
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_run.py", line 318, in open_nursery
await nursery._nested_child_finished(nested_child_exc)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_run.py", line 427, in _nested_child_finished
raise MultiError(self._pending_excs)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio/_core/_run.py", line 1334, in run_impl
msg = task.coro.send(next_send)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio_asyncio/loop.py", line 221, in _run_task
return await proc(*args)
File "foo.py", line 5, in async_main
async with trio_asyncio.open_loop() as loop:
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/async_generator/_util.py", line 34, in __aenter__
return await self._agen.asend(None)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/async_generator/_impl.py", line 274, in asend
return await self._do_it(self._it.send, value)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/async_generator/_impl.py", line 290, in _do_it
return await ANextIter(self._it, start_fn, *args)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/async_generator/_impl.py", line 202, in send
return self._invoke(self._it.send, value)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/async_generator/_impl.py", line 209, in _invoke
result = fn(*args)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio_asyncio/async_.py", line 123, in open_loop
asyncio.set_event_loop(old_loop)
File "/usr/lib/python3.6/asyncio/events.py", line 699, in set_event_loop
get_event_loop_policy().set_event_loop(loop)
File "/home/remmy/code/triwu/venv/lib/python3.6/site-packages/trio_asyncio/loop.py", line 100, in set_event_loop
raise RuntimeError('You cannot replace an event loop.')
RuntimeError: You cannot replace an event loop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment