No multiprocessing print outputs (Spyder) No multiprocessing print outputs (Spyder) python-3.x python-3.x

No multiprocessing print outputs (Spyder)


(Spyder maintainer here) Multiprocessing doesn't work well on Windows in Spyder's IPython console. However, you can run your code in an external terminal to have the results you want.

To do that, please go to

Run > Configuration per file > Execute in an external system terminal


You can run it through Spyders' IPython console by saving the function as a different .py file and importing it into the script you're running. For example, save:

def f(name):    info('function f')    print('hello', name)

In a file called worker.py. Then in your main file, do the following:

from multiprocessing import Processimport osimport workerdef info(title):    print(title)    print('module name:', __name__)    print('parent process:', os.getppid())    print('process id:', os.getpid())if __name__ == '__main__':    info('main line')    p = Process(target=worker.f, args=('bob',))    p.start()    p.join()


you can use log file instead. using fp.write()