[Distutils] [issue112] Shebang for gui_scripts on Windows should be #!pythonw.exe for MSI installers, too

AndiDog setuptools at bugs.python.org
Tue Aug 24 21:54:19 CEST 2010


New submission from AndiDog <AndiDog at web.de>:

This is a follow up to the following problem:

http://stackoverflow.com/questions/3542119/create-launchable-gui-script-from-python-setuptools-without-console-window/3542410#3542410

If I create a MSI installer from a Python package with a computer that has its Python installation in 'C:\Program Files\Python26', and install it on another computer that has it installed in 'C:\Python26', for example, the shebang (for a script in gui_scripts) will still be #!"C:\Program Files\Python26\pythonw.exe"

With bdist_wininst installers, this problem does not occur because the code makes a distinction for them:

    if wininst:
        executable = "python.exe"
    else:
        executable = nt_quote_arg(executable)

In case of a MSI installer, wininst is False and the full absolute path of pythonw.exe is inserted. I can't understand why an absolute path should be necessary. Using a #!pythonw.exe shebang line works even if the matching Python installation is not in the PATH or an incompatible Python version is in the PATH. So I propose to change that first line to

    if wininst or sys.platform == "win32":

----------
messages: 535
nosy: AndiDog
priority: bug
status: unread
title: Shebang for gui_scripts on Windows should be #!pythonw.exe for MSI installers, too

_______________________________________________
Setuptools tracker <setuptools at bugs.python.org>
<http://bugs.python.org/setuptools/issue112>
_______________________________________________


More information about the Distutils-SIG mailing list