Closed roma2023 closed 1 year ago
I tested this on my mac and didn't face any error. Will try it again on some other machine
pipx install poetry
.cd opensearch-py/samples
poetry install
.poetry run hello/hello.py
.If anyone else is experiencing this issue, please feel free to leave a comment here. Thank you!
I think this may be broken (wrongly documented) on Windows. Does poetry run python hello/hello.py
work?
It works on *nix because hello.py has a BOM of #!/usr/bin/env python
and automatically invokes python
.
@roma2023 if you can confirm, let's insert python everywhere we say poetry run ...
in the docs? Will you please help?
@dblock Yes, running poetry run python hello/hello.py
works on Windows machine:
I can take up this issue and open a new PR or fix this at #486. Thank you!
The bug is that running samples with Poetry fails on Windows 10 and Mac when executing poetry run hello/hello.py. It results in a "command not found" error.
The expected behavior is that Poetry should run the samples without any errors.
It works as expected on Linux, but fails on Windows and Mac.
A workaround is to run poetry run python hello/hello.py instead of just poetry run hello/hello.py. This works on Windows.
The root cause seems to be that on Windows, the hello.py script doesn't have the proper shebang line to invoke python automatically.
A fix proposed is to update the documentation to recommend running poetry run python instead of just poetry run on Windows.
User @roma2023 volunteered to submit a PR to fix the documentation.
In summary, it's a documentation issue on Windows due to lack of a proper shebang line in the scripts, and the recommendation is to call python explicitly when using Poetry on Windows.
What is the bug?
Running samples with Poetry fails on Windows 10 and Mac
How can one reproduce the bug?
pipx install poetry
.cd opensearch-py/samples
poetry install
.poetry run hello/hello.py
.What is the expected behavior?
Poetry should run the samples without any errors
What is your host/environment?
Windows 10, Docker 4.17.1 (101757) macOS 10.15
Do you have any screenshots?
The result on Windows machine:
The result on the Mac machine: