In a PyQt application I receive this message:
Could not parse stylesheet of object QLabel(0x560f3d6914e0)
How can I find the exact location of the relevant statement in Visual Studio Code as I do not know which label it is?
In a PyQt application I receive this message:
Could not parse stylesheet of object QLabel(0x560f3d6914e0)
How can I find the exact location of the relevant statement in Visual Studio Code as I do not know which label it is?
2
Answers
Thanks to musicamante I could manage to implement the second solution that required some little corrections:
But it only returned me the label.styleSheet probably due to the fact the error was in an imported module.
The number you see is the memory address for the widget within the Qt space, and that error is just shown in the stdout, so it cannot be directly debugged nor referenced.
In order to get the python object, you would need to wrap its instance using the functions provided by the sip module.
Unfortunately, since that error is given at runtime, you cannot "hardcode" it and convert later, since memory addresses are not persistent.
What you can do, though, is to run the code in an interactive python shell, and also import the
sip
module, then usewrapinstance()
:Alternatively, just add a temporary function that you can activate from a keyboard shortcut or button within your program (or even call it with QTimer) and use QInputDialog functions to do something similar to the above.