AssertionError when threading in Python
You want to specify the target
keyword parameter instead:
t1 = threading.Thread(target=analysis("samplequery"))
You probably meant to make analysis
the run target, but 'samplequery
the argument when started:
t1 = threading.Thread(target=analysis, args=("samplequery",))
The first parameter to Thread()
is the group
argument, and it currently only accepts None
as the argument.
From the threading.Thread()
documentation:
This constructor should always be called with keyword arguments. Arguments are:
- group should be
None
; reserved for future extension when aThreadGroup
class is implemented.- target is the callable object to be invoked by the
run()
method. Defaults toNone
, meaning nothing is called.
You need to provide the target
attribute:
t1 = threading.Thread(target = analysis, args = ('samplequery',))