openmv uasyncio AttributeError: 'module' object has no attribute 'deque'

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
skylin008
Posts: 88
Joined: Wed Mar 11, 2015 6:21 am

openmv uasyncio AttributeError: 'module' object has no attribute 'deque'

Post by skylin008 » 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:

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()

How to solve this issue.Thanks!

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: openmv uasyncio AttributeError: 'module' object has no attribute 'deque'

Post by pythoncoder » Sun Feb 23, 2020 10:37 am

See my comment to your GitHub query.
Peter Hinch
Index to my micropython libraries.

Post Reply