Having a Thread class that when it runs, it starts 2 threads each of witch has its own purpose and they communicate together using a Queue.
One of these threads spawns more threads to process some stuff, I know this might be a bad design but her is my code
class MyThread(Thread):
def __init__(self):
# stuff
Thread.__init__(self)
def run(self):
# some code that start a thread, this one starts fine
# another thread started here and went fine
processing_thread = Thread(target=self.process_files())
processing_thread.daemon = True
processing_thread.start()
# more code
def process_files(self):
while True:
# stuff
self.publish(file)
# stuff
def publish(self, file):
# more code
if (condition):
self.semaphore.acquire(blocking=True)
# HERE IT BREAKS
thread = Thread(target=self.process(), args=(satellite, time, ))
thread.daemon = True
thread.start()
def process(self, satellite, time):
#interpreter does not reach here
I tried staring the thread with:
args=(satellite, time,)
args=(satellite, time)
args=(self, satellite, time,)
args=(self, satellite, time)
I always get the error message TypeError: process() takes exactly 3 arguments (1 given)
What am I missing, or is it even possible to pass arguments this way?