Page 1 of 1

Queue is missing. Any workarounds?

Posted: Sun Jan 31, 2021 1:47 pm
by micropyro
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?

Re: Queue is missing. Any workarounds?

Posted: Mon Feb 01, 2021 8:23 am
by micropyro
I found very simple solution. Simply just copy file from here https://github.com/peterhinch/micropyth ... s/queue.py and everything will work.

Status of uasyncio primitives

Posted: Mon Feb 01, 2021 9:23 am
by pythoncoder
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.