This question is 3 years old: Code is working in pyCharm but not in Visual Studio Code
So, maybe this is the reason why it doesn't work anymore. Anyway, I have this project structure:
It works perfectly when I run "main.py" under "01SpaceInvaders", but the same code in vscode returns this error:
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "C:\Users\salva\Documents\VS Code\pysandbox\game\01SpaceInvaders\main.py", line 5, in <module>
from game.sdfengine.locals import *
ModuleNotFoundError: No module named 'game'
For sure, there is a configuration missing in my VSCode, but I don't know what. Any clue?
This is how I execude the code from VSCode:
- I open a new terminal
- Go to
01SpaceInvaders
py main.py
Following the comments it seems VSCode configuration problem:
Where can I find the file to edit and a guide to understand how to edit it?