Search code examples
pythonqt-designerpyside6pyqt6qtpy

Code generation failed _ Qt Designer in : pyqt6-pyside6-python3.12.1


I have an issue with pyside6 and pyqt6 in Qt Designer that makes me so angry because I tried many ways to solve this problem but I Failed in all of them. when I want to open qt designer python code, I receive an error that I don't know how to fix it. An error about "unrecognized arguments: -g". My Python version is 3.12.1. I attached a picture of that error under this ticket.

enter image description here

I need to access the Python code of that GUI app (made by Qt designer), anyway.


Solution

  • You need to convert the UI file into python code properly. you can use the following from command line:

    pyuic6 -o path_to_output.py -x path_to_input.ui
    

    Or sometimes, if the pyuic6 command is not found from the cli, you can do:

    python -m PyQt6.uic.pyuic -o path_to_output.py -x path_to_input.ui
    

    It will convert the UI file to python script that you can run.