Debugging TypeError: 'NoneType' object is not callable - debugger won't stop
-
Pure python program using PySide6 with QML.
Seeing a TypeError: 'NoneType' object is not callable, but trying to figure out WHERE this is occurring is maddening.
There is no stack trace of file name or line number or any other context clue on where this happening.I've setup PyCharm 2022.1 to stop immediately if TypeError is ever raised.
It stops during main.py startup in unrelated code in the python os.py module once so I know it is setup correctly.
But it never stops again.I'm convinced that TypeError's like this raised from the C code in PySide6 (rather than python code) are not properly visible to the python debugger somehow.
Can anyone get python debuggers to stop on raised exceptions from the C side of PySide6???
PySide 6.3.0 w/ Qt 6.3.0 rebuilt from source with debug enabled for source level debugging when it crashes.
Python 3.8d -
maybe you can share your code as well.
Typically, when you need to debug the C implementation of things, you need to have a local PySide built using the
--debug
flag. In case you want to look into the Python internals, you need to have an interpreter with debug symbols as well.
Then it's just a matter of runninggdb --args python your_code.py
to get into the C implementation. -
Thanks Cristian. I've done all of that (rebuilt PySide locally w/ debug symbols). I built dist wheels for it that don't include the Qt shared libs and then use the LD_LIBRARY_PATH env variable to have the process load the local debug symbol libs for 6.3.0 I built).
If the python process just crashes with a segfault, CLion is properly pulling up source and symbols for the C side code.
But when I run in PyCharm, I cannot get the debugger to stop on this TypeError when its raised. It works for TypeErrors raised from python code. But not from TypeErrors raised by C code apparently which I'm at a loss for.I can't post the code because its a huge code base from 5.12 that I've been trying to upgrade to use PySide6 and Qt 6.3. And that's why its so frustrating as this TypeError exception could be from anywhere across ~75 QML files.
I read about PyErr_Format() which the C code is calling to raise the exception and it appears to be doing the right things so that the debugger should be able to react, but it doesn't work.
Any other ideas?