Poetry changes sys.argv[0]?
See original GitHub issue- 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?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Poetry: conflicting imports - python - Stack Overflow
It looks like after any change in project structure one has to run $ poetry install. again.
Read more >EnvCommandError - cannot get django tutorial to deploy
I created an environment variable to get render to use python 3.8.2 ... file is not up to date with the latest changes...
Read more >A Python program can be outside of a virtual environment it uses
For years, I thought that activating a virtualenv was changing the PATH (so I would get the right binaries in my shell) and...
Read more >poetry script fails to find module - Google Groups
In the poetry shell sys.path has this additional path ... but mainly in honour of a classic dad-joke, I changed 'stoat' to 'weasel'....
Read more >How to use sys.argv in Python - GeeksforGeeks
print ( "This is the name of the program:" , sys.argv[ 0 ]). print ( "Argument List:" , str (sys.argv)). Output: sys.argv.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@fridex That doesn’t really fix the problem. If the user did type in the full path with that code, he would only get the basename.
Duplicate of https://github.com/python-poetry/poetry/issues/965