Queue is missing. Any workarounds?

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
micropyro
Posts: 3
Joined: Sun Jan 31, 2021 1:37 pm

Queue is missing. Any workarounds?

Post by micropyro » Sun Jan 31, 2021 1:47 pm

Hi,

I am trying to replicate this example https://github.com/peterhinch/micropyth ... d#35-queue
however, the primitives module is missing

Code: Select all

>>> from primitives.queue import Queue
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'primitives'
I think there is already an open issue for that in the https://github.com/micropython/micropython/issues/5828. Since it is still open is there any workaround for that?

micropyro
Posts: 3
Joined: Sun Jan 31, 2021 1:37 pm

Re: Queue is missing. Any workarounds?

Post by micropyro » Mon Feb 01, 2021 8:23 am

I found very simple solution. Simply just copy file from here https://github.com/peterhinch/micropyth ... s/queue.py and everything will work.

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

Status of uasyncio primitives

Post by pythoncoder » Mon Feb 01, 2021 9:23 am

The current status is that official uasyncio supports only Lock and Event. I would hope that in due course it will support the same set of primitives as CPython's asyncio. In the mean time my alternatives mimic the API of the asyncio versions, but they are not built-in and need to explicitly be copied to the target.
Peter Hinch

Post Reply