0
import multiprocessing as mp
a=[1,2,3,4,5,6,7,8,9,10]
def doPreprocess(f):
    print("f")

if __name__ == "__main__":
    files = ["hello"] * 10
    pool = mp.Pool(processes=4)
    res = pool.map(doPreprocess, a)

    print ("temp")

The only output from this code is:

temp

From a number of other examples that are claimed to work I have generally the same issue of no processes starting or a pool of processes not starting. If it helps, I am trying to create a set of processes running in parallel. However from what I have read, python 3.7 has issues on windows 10 with spawning processes.

Jared R
  • 1
  • 1
  • How are you executing it? When I run it with `python -m foo` in a shell, it *works* - prints ten `f`'s then `temp`. - gig 'em. – wwii Oct 19 '19 at 04:23
  • I am executing it in the python shell or using the run command in the Python IDE – Jared R Oct 19 '19 at 04:32
  • When I said `shell` I meant PowerShell or cmd in windows. Have your function return stuff then *look* in `res`. – wwii Oct 19 '19 at 04:46
  • 1
    Possible duplicate of [No multiprocessing print outputs (Spyder)](https://stackoverflow.com/questions/48078722/no-multiprocessing-print-outputs-spyder) – Artiom Kozyrev Oct 19 '19 at 15:55
  • Find answer here https://stackoverflow.com/questions/48078722/no-multiprocessing-print-outputs-spyder – Artiom Kozyrev Oct 19 '19 at 15:56

0 Answers0