Closed wku closed 4 years ago
Asyncio libraries are not compatible with curio without using the compatibility bridge.
from curio.bridge import AsyncioLoop import curio import aredis
async def aio_child():
print('
async def run(): async with AsyncioLoop() as loop: r = await loop.run_asyncio(aio_child) print (r.decode())
if name == 'main': curio.run(run)
Attempt to connect asynchronous redis Causes an error
import curio import aredis import asyncio
async def run(): print('run') redis = aredis.StrictRedis(host='127.0.0.1', port=6379, db=0) await redis.flushdb() await redis.set('bar', 'foo') bar = await redis.get('bar') print(bar)
if name == 'main':
So works
"""
..... File "/home/wku/anaconda3/lib/python3.6/asyncio/tasks.py", line 390, in _wait yield from waiter File "/home/wku/anaconda3/lib/python3.6/site-packages/curio/kernel.py", line 844, in _run_coro trapstrap[0] TypeError: '_asyncio.Future' object is not subscriptable ..... """