Search code examples
pythonpyqtsetuptoolspythonw

Using console_scripts entry_points with pythonw?


I've created a python library with a GUI component. I'm creating a command line launcher using the console_scripts feature of setuptools. Currently, when I launch the tool using the console_scripts launcher, it also brings up a command shell because it's being launched with python.exe. Is there a way to use the console_scripts feature but launch the script with pythonw instead so that no command shell appears?

My setup.py looks like this:

from setuptools import setup, find_packages

setup(
    name='mytool',
    version='1.0',
    packages=find_packages(),
    entry_points={
        'console_scripts': ['mytool=mytool.cli:main'],
    },
)

Solution

  • Use gui_scripts instead of console_scripts.

    See this page for more info.