Can't use multiprocessing module to spawn python process on windows for CPU bound works

I’m trying to use the spawn method of multiprocessing to create query workers,

On linux, I can use fork mode, but I can’t use multiprocessing spawn mode directly, because multiprocess will spawn anki with some special command line options as worker which anki not recognize and will fail,I did some hacks and successfully spawned the python process in anki folder,

but on windows, there’s no python exe in anki installation folder, only pythonxxx.dll, which makes it impossible to use multiprocess.

I can’t use threading.Thread because of GIL which is not suitable for CPU bound tasks.

It’s a limitation in the new packaging method in 26.05+: Stub binary doesn't support `sys.executable` spawn/multiprocessing · Issue #4 · beeware/briefcase-linux-system-template · GitHub

Briefcase removes python.exe on Windows by default, but it looks like it’s easy for us to change that.

I’ll log these issues on GitHub.

Good to hear that.
I’m current using a walk around, that is compiling a thin c wrapper that loads pythonxxx.dll and run the Py_Main, links against windows api only, the result exe is only 3kB, but I think bundling the addon with an exe is not a good idea.

Logged here: