Fatal Python error: the function must be called with the GIL held

hi. if another problem. wanted to open the sample file CHOP with Python.

but touchdesigner does not load the dll … not in debug and not in release mode. seems that some python stuff is missing … but iam not able to fint.

thats what i get as an error:
Fatal Python error: the function must be called with the GIL held, but the GIL is released (the current Python thread state is NULL)

here at line 325 it stops
PyTuple_SET_ITEM(args, 1, PyFloat_FromDouble(speed));

please. - im shure it worked some weeks ago cause i did some op’s from that sample

i also recognized, that, if i connect an lfo to the in of the cplulplus i can load the dll. but at the moment of disconnect that - touchdesigner crashes

Which version of Python are you linking with for your .dll?

Version 3.9.5

it worked allready. but something seemes to have changed

and im not able to figure out

Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32

Are you able to share your source file so I can take a look?

of course - but its simply the samples file from the touchdesigner samples folder - i opened in vs and loaded the debug dll into an cplusplus CHOP. as i did weeks ago. but i cant load if there is no node connected and as soon as i disconnect the LFO, it crashes ,

put all together in a zip.

i hope you can tell me, what i did wrong

thx

wetransfer link

Ok thanks, I’ve logged the issue and hope to look at it soon.

1 Like

I see you’ve added extra Python .dlls into the debug directory in your project. This is the issue, you are loading a different copy of Python than the one TD is using, so it’s not working together. I think the solution is to use a Release build, and don’t include those extra .dlls.
In the next release I’ll remove the ‘Debug’ configuration (since that requires Python*_d.dll, which isn’t used by the Release builds of TD), and instead add a RelWithDebugInfo, which will work with TD but also include debuggable code.

ive to apologize. it was my fault :frowning:

i had’nt recognized, that the vcpkg package manager has installed a python. wasn’t carefull enough and did not know, that there are pythons too - not only cplusplus. in vs the option use vcpkg was set to “on” - so there happened some unwanted magic …

sorry and many thanks to your inputs

h

ive located the problem for me - as soon as i switch on “use vcpkg” - python gets wired and it adds some dll’s from the boost or other libraries i’ve hosted in vcpkg. as soon as i switch off that - the pyton in c++ chop works as it should. that belongs to debug and release. maybe you know a solution for that. - thx.