Skip to content

Poetry changes sys.argv[0]? #480

@probablykasper

Description

@probablykasper
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Question

Hi. For the help menus in my CLI scripts, I like to print usage instructions like this:

print("Usage:")
print("    "+sys.argv[0]+" <command> [options]")

But Poetry seems to change sys.argv[0] to the full path of the script, instead of keeping what the user actually typed in. Why? Is there any way around this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/cliRelated to the command line

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions