[Python] 'IterQueue' object has no attribute 'not_full'

Discussão em 'Python' iniciado por Stack, Fevereiro 1, 2025.

  1. Stack

    Stack Membro Participativo

    I have a class called "IterQueue which is an iter queue:

    IterQueue.py

    from multiprocessing import Process, Queue, Pool
    import queue

    class IterQueue(queue.Queue):

    def __init__(self):
    self.current = 0
    self.end = 10000

    def __iter__(self):
    self.current = 0
    self.end = 10000
    while True:
    yield self.get()

    def __next__(self):
    if self.current >= self.end:
    raise StopIteration
    current = self.current
    self.current += 1
    return current


    I put items inside it in a different processes:

    modulexxx.py

    ...
    self.q1= IterQueue()

    def function(self):

    x = 1
    while True:
    x = x + 1
    self.q1.put(x)


    Everything works fine, but python gives me an error:

    'IterQueue' object has no attribute 'not_full


    I searched for this function so I implement it in my custom queue, but found nothing,

    What's the solution to this ?

    Continue reading...

Compartilhe esta Página