Queue.get(block: bool = True, timeout: float | None = None) Any[source]#

Gets an item from the queue.

If block is True and the queue is empty, blocks until the queue is no longer empty or until timeout.

There is no guarantee of order if multiple consumers get from the same empty queue.


The next item in the queue.

  • Empty – if the queue is empty and blocking is False.

  • Empty – if the queue is empty, blocking is True, and it timed out.

  • ValueError – if timeout is negative.