469,643 Members | 1,531 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

Help with Queues and Threading

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?

Jul 19 '05 #1
1 1377
Ognjen Bezanov <og****@mailshack.com> writes:
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?


You have to say args=(cmddata,) with the comma inside the parens,
to make a seqence instead of a parenthesized expression.
Jul 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

By using this site, you agree to our Privacy Policy and Terms of Use.