aioethereum
aioethereum copied to clipboard
Client assume use of uvloop when available
client.py change the event loop policy when uvloop is installed (asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())).
When importing aioethereum, this cause some weird behavior when creating tasks using default event loop from asyncio:
RuntimeError: Task <Task pending coro=<go() running at run_server.py:138>> got Future <Future pending> attached to a different loop
@DurandA , could you provide an example of code which you running?
Here is a snippet that demonstrate this behavior:
import asyncio
loop = asyncio.get_event_loop()
import aioethereum
async def go():
client = await aioethereum.create_ethereum_client(
'http://localhost:8545', loop=loop)
await asyncio.sleep(0.1)
val = await client.web3_clientVersion()
print(val)
loop.create_task(go())
loop.run_forever()
This will run fine when uvloop is not installed but return RuntimeError: Task <Task pending coro=<go() running at aioethereum-fail.py:11>> got Future <Future pending> attached to a different loop otherwise.
solved?
@kuifu not reproduced