3

I'm using python 3.9 to compile a simple Qt6 "Hello World" application in Cython and py2app. It works perfectly fine under CPython 3.9. It compiles properly but fails to run in Cython.

Here are the project files:

testLoad.pyx :

import sys
from PyQt6.QtWidgets import QMessageBox, QApplication

def main():
    app = QApplication(sys.argv)
    QMessageBox(text="Hello World").exec()

if __name__ == "__main__":
    main()

main.py:

import testLoad
from logging import basicConfig

def main():
    testLoad.main()

if __name__ == '__main__':
    main()

and setup.py:

""""
Usage:
    python setup.py py2app
"""

from setuptools import setup
from Cython.Build import cythonize
from Cython.Distutils import build_ext


setup(
    name='test',
    # Include additional files into the package using MANIFEST.in
    include_package_data=True,
    app= ['__main__.py'],
    data_files=[],
    cmdclass = {'build_ext': build_ext},
    ext_modules = cythonize(["testLoad.pyx"], language_level=3),

    setup_requires=['py2app'],
    options={
             'cython': {"language_level":"3"}
            },
    install_requires=[
        "Cython"
    ],
    entry_points={
        "console_scripts": [
            "testLoad = __main__:main"
        ]
    },
)

When I run the program, I get this error on the console:

erreur  17:04:44.035551-0400    test    MTLIOAccelDevice bad MetalPluginClassName property (null)
erreur  17:04:44.047081-0400    test    +[MTLIOAccelDevice registerDevices]: Zero Metal services found

Any idea ?

0 Answers0