Python - Daemon process with Multiprocessing or multithreading

1.2k views Asked by At

I have a Python script which executes an infinite loop (it watches a folder for certain file types).

Once a file type is found, I need it to spawn a new process to process the file. I began to implement this code already (posted here, but now I'm asking a different question about the same topic - not necessarily the same code - hence posting a new question).

However, this infinite loop script needs to run in the background. In my previous question, I implemented this with the infinte loop running in a daemon process, and then the file processing (once a file of a particular type was found) spawned a new process with the mutliprocessing.pool module. However, I found out the hard way that daemon processes cannot start new sub processes.

What might be the best way to implement this functionality???

Is there a better way to get an infinite loop to run in the background and still be able to start new processes with multiprocessing.pool?

0

There are 0 answers