Help with Queues and Threading

Ognjen Bezanov ognjen at mailshack.com
Wed Jun 1 11:33:10 CEST 2005


Hi, all

Thanks all of you who helped me with the threading and queues issue. I
am trying to get it working but I am having problems. When I try to run
the following:


cmddata = mediaplay.initcommandqueue()  #initiates the Queue to send
commands down

mediathread = threading.Thread( target=mediaplay.mainloop,
args=(cmddata) ) #starts the main loop, which will wait for a command
then execute it, Queue object passed to it.

threading.Thread.start(mediathread) # start the thread

I get the following error:

>>> Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.3/threading.py", line 436, in __bootstrap
    self.run()
  File "/usr/lib/python2.3/threading.py", line 416, in run
    self.__target(*self.__args, **self.__kwargs)
TypeError: mainloop() argument after * must be a sequence



But if I run the loop directly (i.e. not using threads, just calling the
function) it works just fine. What could the problem be?




More information about the Python-list mailing list