openmv uasyncio AttributeError: 'module' object has no attribute 'deque'
Posted: Sun Feb 23, 2020 9:03 am
Hello everyone! I had One Openmv4,the firmware information is: MicroPython v1.11-omv OpenMV v3.5.1 2019-12-06; OPENMV4-STM32H743. I had accroding to the https://github.com/peterhinch/micropyth ... UTORIAL.md guide detail description doc and copy the file to uasyncio folder.But when run as follow on openmv4, the error information shows :
File "F:\auart.py", line 49, in <module>
File "uasyncio/core.py", line 224, in get_event_loop
File "uasyncio/__init__.py", line 21, in __init__
File "uasyncio/core.py", line 30, in __init__
AttributeError: 'module' object has no attribute 'deque'
the code is:
How to solve this issue.Thanks!
File "F:\auart.py", line 49, in <module>
File "uasyncio/core.py", line 224, in get_event_loop
File "uasyncio/__init__.py", line 21, in __init__
File "uasyncio/core.py", line 30, in __init__
AttributeError: 'module' object has no attribute 'deque'
the code is:
Code: Select all
import uasyncio as asyncio
import gc
from pyb import UART
uart = UART(3, 9600)
async def sender():
Swriter = asyncio.StreamWriter(uart, {})
try:
while True:
await Swriter.awrite('READY\r\n12345265464563463463456346\r\n')
await asyncio.sleep_ms(10)
except asyncio.CancelledError:
print('Sender Cancelled')
async def receiver():
Sreader = asyncio.StreamReader(uart)
try:
while True:
res = await Sreader.readline()
#res = await Sreader.readexactly(5)
res_str = res.decode('utf-8')
if (res):
print("Received", res)
except asyncio.CancelledError:
print('Receiver Cancelled')
async def _gc():
while True:
await asyncio.sleep_ms(1)
gc.collect()
gc.threshold(gc.mem_free() // 4 + gc.mem_alloc())
gc.collect()
loop = asyncio.get_event_loop()
loop.create_task(sender())
loop.create_task(receiver())
loop.create_task(_gc())
loop.run_forever()