Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

how to create a debugger for pyqt and python code



  • I have a application that python and pyqt code any easier way to debug the application



  • insert a lot of print() functions


  • Qt Champions 2019

    @Qt-Enthusiast said in how to create a debugger for pyqt and python code:

    any easier way to debug the application

    Easier than what?
    Python has a debugger: https://docs.python.org/3/library/pdb.html
    Also you can use debug output as @Kent-Dorfman suggested or use "logging" module to write logs.
    Also, do you use a Python IDE? If so it should provide debugging.



  • @Qt-Enthusiast
    You should already be using an IDE with debugger to develop your code. If you're just using a text editor like Notepad++, which many seem to, then don't! Get yourself sorted out now!!

    My two suggestions would be either VSCode with Python+PyQt support, which is what I am having to use now: it is lightweight but frankly I am finding rather poor. Or my previous, PyCharm+PyQt support: more heavyweight (e.g. start-up time is cumbersome in comparison to VSCode), but I found a much more comprehensive editing/debugging experience. In addition to debugging, PyCharm at least provides a lot of help/warnings about your Python code at editing time, which is very valuable, especially if you are beginner-ish.

    On a separate note, depending on your usage intentions have you considered changing over from PyQt5 to PySide2, which has LGPL licensing (like Qt itself) instead of GPL? Up to you. Code is almost identical from PyQt5 to PySide2 (so you can still basically follow PyQt sample code), the only notable difference is a slight change in how signals are declared.


Log in to reply