Why does my game only run in Visual Studio Code?
Asked by
CreativeNinja42
I'm working on a platformer game using Pygame, and it runs perfectly fine in Visual Studio Code. However, when I try to run it directly from the file, I encounter an error. Here's the code snippet I'm using for reference.
Answers
It's possible you arenโt running the same Python version outside of VScode. Make sure to check which Python version youโre using when running it directly.
Reply to this answer
What error do you get when you try running it directly? It might help to figure out the issue better.
Reply to this answer
Visual Studio Code might run your scripts in a different working directory than where they are located. You should try changing the settings or running your game from its own directory for better results.
Reply to this answer
You might be using different Python interpreters. One could have the modules like Pygame installed, while the other is just the default Python without those modules. That's a common issue.
Reply to this answer
Add your answer
Answers are reviewed before publication.
Related Discussions