Passing a callable object to Thread
Paul Rubin
http
Fri Feb 15 19:23:34 EST 2008
skawaii <skawaii at gmail.com> writes:
> >>> t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/"))
> TypeError: populate_all_tribes() takes exactly 1 argument (8 given)
>
> Can anybody clue me in on what I'm doing wrong? Does my function need
> to have a different signature (i.e. *args, **kwargs) in order for this
> to work?
Thread expects args to be a tuple or list or arguments. You passed it
a list of 8 characters (what we sometimes call a string). You wanted
a tuple containing that list:
t = th.Thread(target=tribalwars.populate_all_tribes, args=("data/w7/",))
More information about the Python-list
mailing list