While running poetry run tox
I encountered the vague error FileNotFoundError
poetry run tox 1:38:03
FileNotFoundError
[Errno 2] No such file or directory: b'/sbin\n\nsource /Users/willcasswrig/.poetry/env/tox'
at /usr/local/Cellar/python@3.9/3.9.12/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os.py:607 in _execvpe
603│ path_list = map(fsencode, path_list)
604│ for dir in path_list:
605│ fullname = path.join(dir, file)
606│ try:
→ 607│ exec_func(fullname, *argrest)
608│ except (FileNotFoundError, NotADirectoryError) as e:
609│ last_exc = e
610│ except OSError as e:
611│ last_exc = e
Note: adding -vvv
verbose flag didn't help
Related bug and error handling thread on GitHub: https://github.com/python-poetry/poetry/issues/1567
Since tox
was listed under the [tool.poetry.dev-dependencies]
section of my pyproject.toml
file, it wasn't automatically added.
Either run poetry add tox
or move from dev-dependencies section into [tool.poetry.dependencies]