Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator don't want to run application, JSONDecodeError: running pyside6-metaobjectdump
Forum Updated to NodeBB v4.3 + New Features

QtCreator don't want to run application, JSONDecodeError: running pyside6-metaobjectdump

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 2 Posters 605 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    djdan
    wrote on last edited by djdan
    #1

    Hello!
    QtCreator does not want to run an application that I wrote a few months ago on another computer, but in a very similar configuration (also on Windows 10). Interestingly, the application itself works OK if I run it directly from the disk, or e.g. via PyCharm. Does anyone know what the reason could be? Theoretically, I can develop the code without using QtCreator, but I am a person who is terribly irritated by all possible errors. Regards!

    53121215-86e7-449d-a370-de15de07f20f-image.png

    15:36:23: Running steps for project NMT...
    15:36:23: Starting: "C:\Users\danie\AppData\Roaming\Python\Python311\Scripts\pyside6-project.exe" build
    Error parsing C:\DANE\QtProjects\NMT\main.py: 'Constant' object has no attribute 'id'
    Traceback (most recent call last):
      File "C:\Users\danie\AppData\Roaming\Python\Python311\site-packages\PySide6\scripts\metaobjectdump.py", line 428, in <module>
        json_data = parse_file(file, context, args.suppress_file)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "C:\Users\danie\AppData\Roaming\Python\Python311\site-packages\PySide6\scripts\metaobjectdump.py", line 388, in parse_file
        visitor.visit(ast_tree)
      File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
        return visitor(node)
               ^^^^^^^^^^^^^
      File "C:\Program Files\Python311\Lib\ast.py", line 426, in generic_visit
        self.visit(item)
      File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
        return visitor(node)
               ^^^^^^^^^^^^^
      File "C:\Users\danie\AppData\Roaming\Python\Python311\site-packages\PySide6\scripts\metaobjectdump.py", line 220, in visit_ClassDef
        self.visit(b)
      File "C:\Program Files\Python311\Lib\ast.py", line 418, in visit
        return visitor(node)
               ^^^^^^^^^^^^^
      File "C:\Users\danie\AppData\Roaming\Python\Python311\site-packages\PySide6\scripts\metaobjectdump.py", line 238, in visit_FunctionDef
        self._parse_function_decorator(node.name, d)
      File "C:\Users\danie\AppData\Roaming\Python\Python311\site-packages\PySide6\scripts\metaobjectdump.py", line 315, in _parse_function_decorator
        type = _python_to_cpp_type(_name(node.args[0]))
                                   ^^^^^^^^^^^^^^^^^^^
      File "C:\Users\danie\AppData\Roaming\Python\Python311\site-packages\PySide6\scripts\metaobjectdump.py", line 71, in _name
        return node.id
               ^^^^^^^
    AttributeError: 'Constant' object has no attribute 'id'
    JSONDecodeError: running pyside6-metaobjectdump on C:\DANE\QtProjects\NMT\main.py: Expecting value: line 1 column 1 (char 0)
    15:36:25: The process "C:\Users\danie\AppData\Roaming\Python\Python311\Scripts\pyside6-project.exe" exited with code 1.
    Error while building/deploying project NMT (kit: Desktop Qt 6.5.3 MinGW 64-bit)
    When executing step "Run PySide6 project tool"
    15:36:25: Elapsed time: 00:02.
    

    INFO:
    Qt Creator 11.0.3, Based on Qt 6.4.3 (MSVC 2019, x86_64), Built on Sep 27 2023 06:38:22
    Python 3.11.6
    Windows 10 Home 22H2, latest updates installed

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you share a minimal script that triggers this error ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        djdan
        wrote on last edited by djdan
        #3

        Minimal (non)working example:

        main.py:

        import sys
        from pathlib import Path
        
        from PySide6.QtCore import QObject, Signal, Property
        from PySide6.QtGui import QGuiApplication
        from PySide6.QtQml import QQmlApplicationEngine
        import os
        
        
        class PyBackground(QObject):
            def __init__(self):
                QObject.__init__(self)
                self.d1 = {'0': 'zero', '1': 'one', '2': 'two'}
        
        
            property_d1_changed = Signal()
        
            @Property('QVariant', notify=property_d1_changed)
            def property_d1(self):
                return self.d1
        
        if __name__ == "__main__":
            app = QGuiApplication(sys.argv)
            engine = QQmlApplicationEngine()
            py_background = PyBackground()
            engine.rootContext().setContextProperty("py_background", py_background)
            engine.load(os.fspath(Path(__file__).resolve().parent / "main.qml")),
            if not engine.rootObjects():
                sys.exit(-1)
            sys.exit(app.exec())
        

        main.qml:

        import QtQuick
        import QtQuick.Controls
        import QtQuick.Window
        
        
        Window {
            width: 640
            height: 480
            visible: true
            title: qsTr("Hello World")
        
            property var d1: py_background.property_d1
        
            Text {
                id: name
                text: qsTr("text: " + d1['2'])
                x: 20
                y: 20
            }
        }
        

        It seems that there is some problem with properties, especially when I want to send python dictionary to qml. Above code is working when run directly from explorer.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          I just tested this on macOS with Qt Creator 11.0.3 but with Python 3.9.6 and it started successfully.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved