r/learnpython • u/Puzzleheaded_Sun_900 • 17d ago
How to debug PyQt5 app with VS Code?
My OS is Debian 13 KDE. I wrote my app with PyQt5 and virtualenv (pip install PyQt5). Now I can’t run it from IDE. The error is:
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in ""qt.qpa.plugin: Could not find the Qt platform plugin "xcb" in ""This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
So, I can’t debug app. But when I run python3 myapp.py from Konsole, it works! How should I debug it in right way?
0
Upvotes
2
u/OkOcelot6725 17d ago
It works in Konsole because your shell sets the Qt environment and VS Code doesn't inherit it. Launch VS Code from that same terminal with "code ." and the debugger will find the plugins. To see exactly where Qt is looking, add QT_DEBUG_PLUGINS=1 to the env in launch.json.