Using multiprocessing¶
When building as a standalone app, pytauri will automatically configure the following to support the use of multiprocessing:
- Set
sys.frozentoTrue - Call multiprocessing.set_start_method with
- windows:
spawn - unix:
fork
- windows:
- Call multiprocessing.set_executable with
std::env::current_exe()
What you need to do is call multiprocessing.freeze_support in __main__.py or in the if __name__ == "__main__": block.
If you don't do this, you will get an endless spawn loop of your application process.
See: https://pyinstaller.org/en/v6.11.1/common-issues-and-pitfalls.html#multi-processing.