Invalid file path when running commands in poetry shell
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). -
OS version and name: Ubuntu 20.04
-
Poetry version: 1.0.5
-
Link of a Gist with the contents of your pyproject.toml file:
[tool.poetry]
name = "events-api"
version = "0.1.0"
description = ""
authors = ["vitaliy-diachkov <diachkovspecial@gmail.com>"]
[tool.poetry.dependencies]
python = "^3.8"
flask = "^1.1.2"
sqlalchemy = "^1.3.18"
gunicorn = "^20.0.4"
pg8000 = "^1.16.3"
python-dateutil = "^2.8.1"
psycopg2-binary = "^2.8.5"
pydantic = "^1.6.1"
google-cloud-secret-manager = "^1.0.0"
o365 = "^2.0.10"
google-api-python-client = "^1.10.0"
rfc3339 = "^6.2"
google-auth-oauthlib = "^0.4.1"
flask-swagger-ui = "^3.25.0"
pyyaml = "^5.3.1"
pytz = "^2020.1"
pytest = "^6.0.1"
python-dotenv = "^0.14.0"
[tool.poetry.dev-dependencies]
ptpython = "^3.0.5"
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
Issue
Hi, I have a project structure like this
.
|__ pyproject.toml
|__ poetry.lock
|__ src/
|__ main.py
The issue is, when I’m running
poetry shell
cd src
python3 main.py
I got this error:
* Serving Flask app "main" (lazy loading)
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Running on http://0.0.0.0:8080/ (Press CTRL+C to quit)
* Restarting with stat
/home/vitaliy/.cache/pypoetry/virtualenvs/events-api-QpbODKYT-py3.8/bin/python3: can't open file '.../events-api/main.py': [Errno 2] No such file or directory
So, as you see it is starting the Flask app first and then I got an error because it is trying to open events-api/main.py
instead of events-api/src/main.py
. What could be the reason of such behavior?
Everything works fine when I’m in project root directory and starts the flask app using python3 src/main.py
.
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
All my poetry commands fail with 'The Poetry config is invalid'
A multi-line string is not valid for the description field. The error message does not match '^[^\n]*$' is telling you that it is...
Read more >The pyproject.toml file | Documentation | Poetry
The pyproject.toml file The tool.poetry section of the pyproject.toml file ... A path, or list of paths corresponding to the README file(s) of...
Read more >Configuration - Starship: Cross-Shell Prompt
You can change default configuration file location with STARSHIP_CONFIG environment variable: export STARSHIP_CONFIG=~/example/non/default/path/starship.
Read more >poetry install [errno 2] no such file or directory: 'python'
Invalid file path or directory path. Using a relative path. Solution to FileNotFoundError: [Errno 2] No such file or directory. In Python, when...
Read more >Settings Reference for Python - Visual Studio Code
The default value "poetry" assumes the executable is in the current path. ... you run a file using commands such as Python: Run...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve found that I only have issues when I’m using python-dotenv package, so probably not a poetry issue
Here is the example: https://github.com/vitaliy-diachkov/flask-poetry-dotenv-issue-example
I can create an example repo tomorrow (with a hello world Flask application), so you can test this on your own.