Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to open project after converting QML file to pyd and compiling with UPX #2799

Closed
wangyaoyong-wyy opened this issue Mar 31, 2024 · 1 comment
Assignees
Labels

Comments

@wangyaoyong-wyy
Copy link

My environment
1.python 3.11.7
2.nuitka 2.0.6
3.pyside6 6.6.2

Code:

1.main.py

# This Python file uses the following encoding: utf-8
import sys
from PySide6.QtGui import QGuiApplication
from PySide6.QtQml import QQmlApplicationEngine
import qml_resouorce

if __name__ == "__main__":
    app = QGuiApplication(sys.argv)
    engine = QQmlApplicationEngine()
    engine.load("qrc:/qml/main.qml")
    if not engine.rootObjects():
        sys.exit(-1)
    sys.exit(app.exec())

2.main.qml

import QtQuick
import QtQuick.Window

Window {
    width: 640
    height: 480
    visible: true
    title: qsTr("Hello World")
    Loader {
        id: redButtonLoader
        source: "newbutton.qml"

        anchors.centerIn: parent
        onLoaded: {
            console.log("加载文件")
        }
    }
}

3.newbutton.qml

import QtQuick
import QtQuick.Controls

Button {
    id: redButton
    width: 100
    height: 100
}

4.qml_resource.qrc

<RCC>
  <qresource prefix="qml">
    <file>main.qml</file>
    <file>newbutton.qml</file>
  </qresource>
</RCC>

Step:

1.Use pyside6-rcc.exe to compile QML_resource.qrc into a py file
2.Using commands:

python -m nuitka --show-progress --show-memory --mingw64 --disable-ccache --module --lto=no qml_resouorce.py

3.Using command:

python -m nuitka --show-progress --show-memory --mingw64 --standalone --enable-plugin=pyside6,upx --upx-binary=upx --disable-ccache --debug --include-qt-plugins=qml main.py

If UPX is not used, the packaged product can run normally.
But after adding UPX, it cannot be opened, and the window does not print anything

@kayhayen
Copy link
Member

kayhayen commented Apr 2, 2024

You are not using the latest version of Nuitka. I am not sure I care about UPX enough to look into this, giving that's it's an incomplete report and the guessing necessary due to lack of issue template.

@kayhayen kayhayen closed this as completed Apr 2, 2024
@kayhayen kayhayen self-assigned this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants