question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

poetry run causes [FileNotFoundError] with some scripts

See original GitHub issue
  • 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 (-vvv option).

Issue

Using poetry run to run scripts fails on some scripts. I think this is probably in cases where the script has no file extension. The linked pyproject.toml installs scons into the virtual environment. Scons comes with a script called scons which is installed in the Scripts directory. The following error occurs when running the script:

c:\Projects\personal\poetry-scons-issue>poetry run scons

[FileNotFoundError]
[WinError 2] The system cannot find the file specified

Running poetry venv info to get path/to/venv and running scons with the explicit path works fine

> path\to\venv\Scripts\scons

scons: *** No SConstruct file found.
......

scons also comes with a script called scons.bat which does the same thing. poetry run scons.bat does work

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
kevinconcommented, Nov 22, 2020

I think this is also a duplicate of #3265 which I have this PR up to fix: #3339

0reactions
andschwacommented, Nov 24, 2020

@sinoroc Yes, I think these are all the same issue. I have a question: what’s then intention behind env.py’s _bin(bin) method? I inferred that it’s to check Poetry’s virtualenv first (that’s what the code sure is doing by looking at self._bin_dir / bin first, and only falling back to bin if nothing was found in self._bin_dir). If this is indeed the case, that lends credence to my recommendation I made here: https://github.com/python-poetry/poetry/pull/3395#issuecomment-732546336

@kevincon @huwper Can you both take a look and confirm? I definitely borrowed from both your PR’s and am happy to go change the authorship. In fact, let me go do that! This was definitely a joint effort.

Read more comments on GitHub >

github_iconTop Results From Across the Web

poetry run tox FileNotFoundError - python - Stack Overflow
Since tox was listed under the [tool. poetry. dev-dependencies] section of my pyproject. toml file, it wasn't automatically added.
Read more >
No Such File Or Directory: Python - avvocatopollara.it
Filenotfounderror Errno 2 no such file or directory is a python error ... We can run the following script to solve the error...
Read more >
[SOLVED] Python filenotfounderror - A Quick Guide - AskPython
It is a system message that the compiler throws when you are trying to execute a command that requires a file that the...
Read more >
Configure a Poetry environment | PyCharm Documentation
Poetry is a tool that facilitates creating a Python virtual environment based on the project dependencies. You can declare the libraries your project ......
Read more >
poetry install [errno 2] no such file or directory: 'python'
You'll find specifying an alias for python to python3 won't work ( unless, perhaps you specify this in your bashrc instead of any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found