https://bugs.kde.org/show_bug.cgi?id=410807

--- Comment #7 from Rebecca Breu <rebe...@rbreu.de> ---
Unfortunately, this is a very tricky issue.

The debugger wants to spawn a subprocess for debugging the script. On Linux and
(I assume) MacOS, this works by forking the current process.

On Windows, there's no way to fork/clone the current process, so as a
workaround, Python's multiprocessing library starts a new process from scratch
and gives it the parent process's argv to provide such things as the Python
executable, Python script etc. However, since we are running an embedded
Python, the parent process has no argv and trying to access that attribute
fails with the error posted by the bug reporter. It's possible to set argv
manually before spawning the subprocess, but that way, we could only provide a
system Python executable (if it even exists), not Krita's embedded Python since
that's not an executable.

See for example here:
https://stackoverflow.com/questions/15636266/embedded-python-multiprocessing-not-working

Here's the same issue with a user script in Blender:
https://blender.stackexchange.com/questions/8530/how-to-get-python-multiprocessing-module-working-on-windows

The only fix that I can think of is rewriting the debugger to use threads
instead of subprocesses, but that could potentially cause other issues, like
thread-safety and issues with Python's GIL.

Not sure if Blender has a debugger like this—might be worth looking into?

If we can't solve it, we could at least deactivate the debugger on Windows, or
catch the error with a meaningful popup for the user.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to