QPrinter dosn't see any printers after cx-Freeze

104 Views Asked by At

Working on GUI on Python (3.6.5 on win32), PyQt5 (5.10.1), use cx_Freeze (5.1.1).

There is function to use printers. py :

    def goPrinter(self):
        print("___goPrinter")
        printer = QtPrintSupport.QPrinter()
        print(printer)
        print(printer.printerName())
        print(QtPrintSupport.QPrinterInfo.availablePrinterNames())
        print("return")

When I run py - script, printer works fine.

cmd:

-__goPrinter

-PyQt5.QtPrintSupport.QPrinter object at 0x02FF1EBO>

-Microsoft XPS Document Writer

-['Microsoft XPS Document Writer', 'FAX']

-return

When I run exe file (after cx-Freeze), any printers are invisable. Printing doesn't work.

cmd:

-__goPrinter

-PyQt5.QtPrintSupport.QPrinter object at 0x02BB23B0>

-

-[]

-return

setup.py script for creating exe:

    from cx_Freeze import setup, Executable

    executables = [Executable('KIWI_1105.py',
                      targetName='KIWIv17.exe',
                      icon='iconsN\capsule.ico',
                      shortcutName='KIWI',
                      shortcutDir='DesktopFolder'
    )]

    excludes = ['email', 'http', 'urllib', 'unittest']

    zip_include_packages = ['collections','distutils', 'encodings',
                            'importlib', 'logging', 'imageformats',
                            'platforms', 'PIL', 'pydoc_data', 'PyQt5', 'xml']

     include_files = ['iconsN', 'Atlas']

     options = {
               'build_exe': {
                   'excludes': excludes,
                   'zip_include_packages': zip_include_packages,
                   'include_files': include_files,
                   'include_msvcr': True,
                   'build_exe': 'KIWI',
               }
     }

     setup(name='KIWI App',
           author='23',
           version='17.1505',
           description='KIWI Viewer Application',
           executables=executables,
           options=options)
0

There are 0 best solutions below