From 56760f9dffb93d58e19ed3c5c42e0f4259bf6df7 Mon Sep 17 00:00:00 2001 From: Derek Holloway Date: Mon, 16 Feb 2026 12:33:09 -0800 Subject: [PATCH] Fix for worker thread spawning of python --- WebServer/Controllers/PythonInterop.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/WebServer/Controllers/PythonInterop.cs b/WebServer/Controllers/PythonInterop.cs index 87ea3ea4..ea723ab5 100644 --- a/WebServer/Controllers/PythonInterop.cs +++ b/WebServer/Controllers/PythonInterop.cs @@ -16,6 +16,9 @@ namespace PythonInterop { // Initiilize python PythonEngine.Initialize(); + + // Needed because C# calls the python from each connections worker thread + PythonEngine.BeginAllowThreads(); } // This is thread blocking, runs on the main thread, and takes multiple minutes so probabaly need to run on a background thread at some point