2

I'm installing poetry using the get-poetry.py script, and I want to specify the version to install. To install the latest version I do

GET_POETRY_URL=https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py
curl -sSL $GET_POETRY_URL | python

The get-poetry.py script takes an argument --version, but how do I pass that through?

curl -sSL $GET_POETRY_URL | python --version 1.1.4

prints the installed python version, rather than passing the argument through to the get-poetry.py script. I could save the script to a file and call it that way, but I'm doing this in a docker image and I don't want to deal with cleaning it up afterwards.

1 Answer 1

3
curl -sSL $GET_POETRY_URL | python - --version 1.1.4

Using - as the script location when you call python will cause it to read from stdin. As usual, any arguments after the script location are passed to the script:

$ echo "import sys; print(sys.argv)" | python - --version 1.1.4
['-', '--version', '1.1.4']

Using - to mean stdin also works for many other unix tools:

$ echo hello | cat -
hello
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.