How to run in STA without spawning an extra thread
I want to create a WPF app, which requires a STA thread. Unfortunately the main-thread of python.exe runs in MTA and thus cannot be utilitized. I had to spwan an extra thread, But this makes my IDE's (PyCharm) debugger not work any more (does not stop on breakpoints). I downloaded the Python.NET sources to create a version that runs in STA, but I failed to find any piece of code, that activates MTA (and which I could change to STA). I expected it to be in "/src/monoclr/pynetinit.c", but here I only found the code to load Python.Runtime.dll. can anyone give me a hint? regards, Robert
Ah I can answer the questions myself: Run the following sequence BEFORE "import clr": import ctypes ctypes.windll.ole32.CoInitialize(None)
Ah I can answer the questions myself: Run the following sequence BEFORE "import clr": import ctypes ctypes.windll.ole32.CoInitialize(None)
Ah I can answer the questions myself: Run the following sequence BEFORE "import clr": import ctypes ctypes.windll.ole32.CoInitialize(None)
participants (1)
-
robert.hoelzl@posteo.de