This question did not help:
Please note I added below line in my program and that did not help to resolve the problem as explained below on Ubuntu platform.
multiprocessing.freeze_support()
Failed to create nested child process when python exe built using auto-py-to-exe on Ubuntu.
Below Python program works ok when I run it using python3 command on Ubuntu platform.
import multiprocessing as mp
def P3_sm():
print("P3 created.")
print("P3 destroyed.")
def P2_sm():
print("P2 created.")
P3 = mp.Process(target=P3_sm)
P3.start()
P3.join()
print("P2 destroyed.")
if __name__ == '__main__':
mp.freeze_support() # ADDING THIS LINE DID NOT HELP!
print("P1 created.")
P2 = mp.Process(target=P2_sm)
P2.start()
P2.join()
print("P1 destroyed.")
I built an exe using auto-py-to-exe tool which formed below command and generated exe. pyinstaller --nonconfirm --onefile --windowed "/home/max/test/main.py"
When I run this exe it only prints below 2 lines and never terminates the program. Any help is highly appreciated!
P1 created.
P2 created.
I tried solution as per below link but that did not work for me.
PyInstaller and multiprocessing
When I run the exe file on Ubuntu platform I'm expecting it to print below 6 lines and terminate the program as it does when I run the main.py file using python3 command.
P1 created.
P2 created.
P3 created.
P3 destroyed.
P2 destroyed.
P1 destroyed.