79135739

Date: 2024-10-29 03:20:30
Score: 1
Natty:
Report link

When freezing Python codes with modules like pyinstaller or aut_py_to_exe, there are possibilities that some modules might not work as they specifically require certain functions from the Interpreter.

As @Aaron mentioned, putting the multiprocessing.freeze_support() will do.

But sometimes, the freeze_support() might have to be put before import as specified by pyinstaller's documentation:

This might be necessary if your script imports a module that does one of the following during its initialization (i.e., when it is imported):

  • makes use of multiprocessing functionality.
  • parses command-line arguments for your program.
  • imports and initializes a GUI framework. While this might not result in an error, it should be avoided in the worker processes by diverting the program flow before it happens.

They provided a detailed explanation of the multiprocessing module with freezing codes; You can get much information from it.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Aaron
  • Starts with a question (0.5): When
  • Low reputation (0.5):
Posted by: hokwanhung