Skip to content

Run python script as a child process - #184

Open
copygirl wants to merge 1 commit into
mainfrom
python-child-process
Open

Run python script as a child process#184
copygirl wants to merge 1 commit into
mainfrom
python-child-process

Conversation

@copygirl

Copy link
Copy Markdown
Collaborator

Changes the python RPC wrapper addon to run the process in a thread using execute instead of create_process, which is blocking but actually starts the process as a child process, ensuring that it is cleared up when the parent process (SnekStudio) is closed even if something goes horribly wrong either on the SnekStudio or Python side.

There's a slight issue currently where, even thought it's recommended, I have to skip calling wait_to_finish because it will just block forever. Ideally, the python process should gracefully close after its communication sockets are closed, but this appears to not be the case. Unfortunately I'm not familiar enough with the python code (or the language in general) to be able to debug this. (Funnily enough, if it was working properly, it'd be less likely we'd need to run it as a child process, but it's probably the right choice, anyway.)

As a result, this currently prints the following warning:

KiriPythonWrapperInstance.gd:296 @ stop_process(): A Thread object is being destroyed without its completion having been realized. Please call wait_to_finish() on it to ensure correct cleanup.

Fixes #57.
Fixes #103.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Webcam connection remains open after closing software Python processes not killed on windows 11

2 participants