Strange Queue error

Trent Mick trentm at ActiveState.com
Wed Jul 24 15:36:40 EDT 2002


[Marc wrote]
> I was attempting to use the Queue and came across a strange error. Why
> is Python wanting a Queue instance as an argument and not accepting
> the tuple. I was simply trying to put this on the queue:
> 
> 
>     qlist.put( (sleep, 5) )
> 
> Here is the error.
> 
> C:\Python22\CAP v1.0\queue>python temp2.py
> Project is a go
> in check
> Exception in thread Thread-1:
> Traceback (most recent call last):
>   File "C:\Python22\lib\threading.py", line 408, in __bootstrap
>     self.run()
>   File "C:\Python22\lib\threading.py", line 396, in run
>     apply(self.__target, self.__args, self.__kwargs)
>   File "temp2.py", line 586, in launch
>     main.launchUTStest()
>   File "main.py", line 31, in launchUTStest
>     eval( modules.securityFunctions[mod] )(gui, qlist)
>   File "security.py", line 35, in uid_gen_format
>     qlist.put( (sleep, 5) )
> TypeError: unbound method put() must be called with Queue instance as
> first argu
> ment (got tuple instance instead)
> 
> Does anyone know what this means?

It likely means that you are passing around a Queue *class* object
instead of a Queue class *instance*. You probably have a 
    qlist = Queue
somewhere instead of:
    qlist = Queue()

Trent

-- 
Trent Mick
TrentM at ActiveState.com




More information about the Python-list mailing list