[pydotorg-www] Bug multiprocessing.Process Python 3.8.2 Shell

Gerhard Tröster gerhard.troester at ethz.ch
Sat Apr 11 06:37:04 EDT 2020


In the simple program

    # importing the multiprocessing module
    import multiprocessing
    def print_cube(num):
         print("Cube: {}".format(num * num * num))
    def print_square(num):
         print("Square: {}".format(num * num))
         
    if __name__ == "__main__":
         # creating processes
         p1 = multiprocessing.Process(target=print_square, args=(10, ))
         p2 = multiprocessing.Process(target=print_cube, args=(10, ))
         # starting process 1
         p1.start()
         # starting process 2
         p2.start()
         # wait until process 1 is finished
         p1.join()
         # wait until process 2 is finished
         p2.join()
         # both processes finished
         print("Done!")

the Python Shell 3.8.2 (both the 32 and 64 Bit version) does not execute 
the multiprocessing.Process  instruction, and outputs

= RESTART: C:\Users\gerhartr\Desktop\Python\Concurrent\Multiprocessing\python1.py
Done!
>>>  

Using the cmd python.exe command,  the correct output

Square: 100
Cube: 1000
Done!

This error can be documented also in other programs which uses the 
multiprocessing.Process instruction.

best
Gerhard

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pydotorg-www/attachments/20200411/0cd19218/attachment.html>


More information about the pydotorg-www mailing list