python-poetry / python-poetry/poetry
tool.poetry.scripts fails because of a space in path to env
@Secrus is already working on this.
Since Sep 25, 2024.
- Dominant language
- Python
- Stars
- 34.3k
- Forks
- 2.5k
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 30
Description
- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvvoption).
- macOS 10.15.7:
- Poetry 1.1.4:
- https://gist.github.com/mklengel/bcf374677212ac03e78ef68bc28a1ee0:
Issue
I followed two articles of Jonathan Bowman:
https://dev.to/bowmanjd/getting-started-with-python-poetry-3ica
https://dev.to/bowmanjd/build-command-line-tools-with-python-poetry-4mnc
In my case the project folder contains a space, which most likely is the reason for the problem.
The entry in pyproject.toml is:
[tool.poetry.scripts]
greet = "greet.location:cli"
The result of calling "greet" is:
(.venv) ➜ pygreet greet
zsh: /Volumes/Macintosh SR0/Users/mklengel/Development/pygreet/.venv/bin/greet: bad interpreter: /Volumes/Macintosh: no such file or directory
Having a look in the shebang line of greet shows of course the space in the path:
(.venv) ➜ pygreet head -1 .venv/bin/greet
#!/Volumes/Macintosh SR0/Users/mklengel/Development/pygreet/.venv/bin/python
The shebang line is created by poetry.
A possible workaround with a symlink to eliminate the space fails:
(.venv) ➜ ~ pwd
/Users/mklengel
(.venv) ➜ ~ ls -l Development
lrwxr-xr-x 1 mklengel staff 49 Jan 15 22:03 Development -> /Volumes/Macintosh SR0/Users/mklengel/Development
(.venv) ➜ ~ cd Development/pygreet
(.venv) ➜ pygreet pwd
/Users/mklengel/Development/pygreet
(.venv) ➜ pygreet poetry shell
Virtual environment already activated: /Volumes/Macintosh SR0/Users/mklengel/Development/pygreet/.venv
poetry "sees" the path but ignores the symbolic link.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.