Skip to content

Incorrect sys.argv[0] for generated console scripts on Windows #459

Closed

Description

Originally reported by: pombredanne (Bitbucket: pombredanne, GitHub: pombredanne)


The code that generates entry point console script return an incorrect value for sys.argv[0] on windows:
https://bitbucket.org/pypa/setuptools/src/4ce518784af886e6977fa2dbe58359d0fe161d0d/setuptools/command/easy_install.py?at=default&fileviewer=file-view-default#easy_install.py-2008

Even if the script was called from the CLI as XXXX, sys.argv[0] will be XXXX-script.py
It should instead by XXXX.

pip handles this by fixing sys.argv[0] in the generated launcher script for wheels here https://github.com/pypa/pip/blob/1da0ea13f3f0ab789edd62012d09bf69be045f68/pip/wheel.py#L416

distlib fixes sys.argv[0] here in a similar way in the launcher script :
https://bitbucket.org/pypa/distlib/src/6ada86eea2700f10edcd81f831139c6ae20edb74/distlib/scripts.py?at=default&fileviewer=file-view-default#scripts.py-55

Setuptools does not and it should IMHO.

See also this issue: pypa/pip#3233

And where this was discovered: pallets/click#365


Activity

  1. ghost added on Mar 29, 2016
  2. added a commit that references this issue on Aug 16, 2016
  3. added a commit that references this issue on Aug 20, 2016
  4. ofek commented on Jun 14, 2020

    @ofek
    SponsorContributor

    @jaraco This is fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions