Strange Queue error

Skip Montanaro skip at pobox.com
Wed Jul 24 15:34:56 EDT 2002


    Marc>     qlist.put( (sleep, 5) )
    Marc> TypeError: unbound method put() must be called with Queue instance as

Sounds like you set the qlist variable like so:

    qlist = Queue.Queue

instead of 

    qlist = Queue.Queue()

Note the difference:

    >>> import Queue
    >>> qlist = Queue.Queue()
    >>> import time
    >>> qlist.put((time.sleep, 5))
    >>> qlist = Queue.Queue
    >>> qlist.put((time.sleep, 5))
    Traceback (most recent call last):
      File "<stdin>", line 1, in ?
    TypeError: unbound method put() must be called with Queue instance as first argument (got tuple instance instead)

-- 
Skip Montanaro
skip at pobox.com
consulting: http://manatee.mojam.com/~skip/resume.html




More information about the Python-list mailing list