Python 3.2 Multiprocessing.Process does not work target function

I have a problem and I canโ€™t understand what the problem is. Embedded code (the simplest example code from documents 3.2, just for debugging) DOES NOT launch the target function. The process ends, the program imports and starts without errors, Python 3.2 is correctly installed and the directory is added to the Path environment variable. I run the program from IDLE with f5, and every other bit of code works fine, but the code in the target function "f" (in this case) JUST WILL NOT MISS. As you know, this is inconvenient. This code will not print, and each test fingerprint in the target function (as well as any function) simply does not execute; he just missed.

#!/usr/bin/env python from multiprocessing import Process def f(name): print('hello', name) if __name__ == '__main__': p = Process(target=f, args=('bob',)) p.start() 

Any thoughts? I am running Python 3.2 on a Windows 7 system, and multiprocessing works successfully on my system with Python 2.7 (although my project requires me to develop in 3.2). Sorry for such a simple problem, which I suppose should be some kind of path problem, but I'm just not sure what I need to do to get this to work, and could not find any solution from Google, as Python will definitely recognize the package (and crash on error); he just does not behave correctly. Thanks for any help / advice!

+4
source share
1 answer

Multiprocessing and IDLE do not work well. Make sure it works outside of IDLE, and if so, you are good.

I do not use the IDE myself, so I have no others to offer you, but it is amazing how useful a simple print for debugging can be.

+2
source

Source: https://habr.com/ru/post/1439009/


All Articles