1

I am working on a python app using VS Code. I work with the following structure:

my_app
├── venv
├── my_app
│   ├── __init__.py
│   ├── main.py
│   ├── module_1
│   │   ├── __init__.py
│   │   ├── functionality_1.py
│   │   └── functionality_2.py
│   ├── module_2
│   │   ├── __init__.py
│   │   └── functionality_3.py
│   └── ...

When I try to run the main.py I get a ModuleNotFoundError. I can see that the path where the terminal is starting from is the top my_app directory. If I use cd to go one level lower to the bottom my_app directory, I am able to run the script without error.

Even though I have a workaround, this is not ideal. For example, the debugger also starts from the top my_app directory and I did not find a workaround for that.

I can also open the bottom my_app folder in VS code. The issue then becomes that the virtual environment that I have created is one level higher and VS code does not find it.

Is there something I am doing wrong in the structuring of my app? Or am I missing something else?

1 Answer 1

1

I figured it out. The top folder and package folder (my_app) should be named exactly the same.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.