Skip to content
Advertisement

how to make a package(pypi) for pyqt5 app on windows?

I wrote an application with pyqt5 and packaged it using python setup.py sdist to make it available on PyPi the app runs well on Linux distributions but there is a problem with windows when i run it ,it does open a console then the actual app shows up is there any way to fix it ?

enter image description here

setup.py

from distutils.core import setup
from setuptools import setup

setup(
    name="subtodl", 
    packages = ['Scripts'], 
    version="0.0.1",
    license='MIT',     
    description = 'a handy tools to download subtitle ',   
    author = 'mehdi',                  
    install_requires=[
    "pyqt5; platform_system=='Windows'", 
    "beautifulsoup4", 
    "lxml",
    "PyQt5==5.11.3 ;platform_system=='Linux'",
    "requests",
    "wget",
    ],
    classifiers=[
        "Programming Language :: Python :: 3.6",
    ],
    entry_points={

        'console_scripts': [
        'subtodl= Scripts.subtodlmain:main',
    ],
    },
)


Advertisement

Answer

Instead of 'console_scripts', use 'gui_scripts'.

Two groups of entry points have special significance in packaging: console_scripts and gui_scripts.

[…]

The difference between console_scripts and gui_scripts only affects Windows systems. console_scripts are wrapped in a console executable, so they are attached to a console and can use sys.stdin, sys.stdout and sys.stderr for input and output. gui_scripts are wrapped in a GUI executable, so they can be started without a console, but cannot use standard streams unless application code redirects them. Other platforms do not have the same distinction.

The packaging guide

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement