Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Poetry failing to recognize file directory #493

Closed
roma2023 opened this issue Sep 13, 2023 · 5 comments
Closed

[BUG] Poetry failing to recognize file directory #493

roma2023 opened this issue Sep 13, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@roma2023
Copy link
Contributor

roma2023 commented Sep 13, 2023

What is the bug?

Running samples with Poetry fails on Windows 10 and Mac

How can one reproduce the bug?

  1. Install Poetry in the home directory using pipx install poetry.
  2. Navigate to the "opensearch-py/samples" directory. cd opensearch-py/samples
  3. Install the project dependencies with poetry install.
  4. Execute 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:

$ poetry run hello/hello.py
"hello" is not an internal or external
command, executable program, or batch file.
(base)

The result on the Mac machine:
image

@roma2023 roma2023 added bug Something isn't working untriaged Need triage labels Sep 13, 2023
@saimedhi
Copy link
Collaborator

I tested this on my mac and didn't face any error. Will try it again on some other machine

  1. Installed Poetry in the home directory using pipx install poetry.
  2. Navigated to the "opensearch-py/samples" directory. cd opensearch-py/samples
  3. Installed the project dependencies with poetry install.
  4. Executed poetry run hello/hello.py.

@saimedhi
Copy link
Collaborator

If anyone else is experiencing this issue, please feel free to leave a comment here. Thank you!

@saimedhi saimedhi removed the untriaged Need triage label Sep 13, 2023
@dblock
Copy link
Member

dblock commented Sep 14, 2023

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?

@roma2023
Copy link
Contributor Author

roma2023 commented Sep 14, 2023

@dblock Yes, running poetry run python hello/hello.py works on Windows machine:
image

I can take up this issue and open a new PR or fix this at #486. Thank you!

@ReinGrad
Copy link

  • 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants