4

I have a PySide2 application, which uses QML to display the user interface. The application works from the command line. I can also launch it as well as debug it in QtCreator. However, when I try to run QmlProfiler, I see the following error:

:-1: error: /home/username/code/project/venv/bin/python: Error while finding module specification for 'ljsdebugger=file:/tmp/QtCreator-kVUFuF/qtcreator-freesocket.XgLEKq,block,services:CanvasFrameRate,EngineControl,DebugMessages,DebugTranslation' (ModuleNotFoundError: No module named 'ljsdebugger=file:/tmp/QtCreator-kVUFuF/qtcreator-freesocket')

I checked project's kit settings and it is using all the defaults. I could not find any relevant articles/discussions with this error message on the web. How to resolve this issue?

WhiteStork
  • 385
  • 1
  • 15

2 Answers2

7

Solving this involves two steps:

  1. Make the application debugging enabled

Add the line before QApplication is instantated:

from PySide2.QtQml import QQmlDebuggingEnabler

debug = QQmlDebuggingEnabler()
  1. Connect it to the QML Profiler

run the application with the command line parameter: -qmljsdebugger=port:10002,block with the port of your choice. Then go to Analyze>QML Profiler (Attach to Waiting Application) and choose the port you started the program with: enter image description here

This successfully connected the program to the QML Profiler.

WhiteStork
  • 385
  • 1
  • 15
-1
from PySide6.QtQml import QQmlDebuggingEnabler

debug = QQmlDebuggingEnabler()

it also useful in pyside6 , tks bro @WhiteStork

kw Ban
  • 16
  • 3
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 25 '22 at 08:46