I have a problem and I can’t figure out what the issue is. The embedded code (the simplest sample code from the 3.2 docs, just to try to debug) WILL NOT run the target function. The Process completes, the program imports and runs without error, Python 3.2 is correctly installed and the directory added to the Path environment variable. I am running the program from IDLE with f5, and every other bit of code works perfectly, however the code within the target function ‘f’ (in this case) SIMPLY DOES NOT RUN. As you can understand, this is suuuuper frustrating. This code will not print, and every test print within the target function (as well as any function) simply does not execute; it is simply skipped over.
#!/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’m running Python 3.2 on a Windows 7 system, and multiprocessing has successfully run on my system with Python 2.7 (though my project DOES require me to develop in 3.2). Sorry for such a simple problem which I imagine must be some path problem, but I’m just not sure what I might have to do to make this work and couldn’t find any solution from Google, since Python certainly recognizes the package (and fails when it’s misspelled); it just doesn’t behave correctly. Thanks for any help/advice!!
Multiprocessing and IDLE don’t work well together. Make sure it runs outside IDLE, and if so, you’re good.
I don’t use IDEs myself so I have no others to offer you, but it is amazing how useful simple
prints can be for debugging.