Fixing VS Code Python `can't open file` Error
Short summary: If Python runs once in VS Code but fails on the second run with can't open file ... No such file or directory in Terminal.
The most common cause is a broken path caused by spaces or special characters (like ∆ or ☮) in the folder name.
Quick fix (30 seconds) :
Move your project to a folder without spaces or special symbols (example: C:\PythonProjects\MyApp) and re-open it in VS Code.
Why it happens
Spaces and symbols cause incorrect quoting of the command that runs Python from VS Code/Code Runner, so subsequent runs can fail.
Fixes & tips
- Use clean folder names (no spaces/symbols).
- Configure Code Runner to quote properly (settings.json snippet in the full post).
- Use Debug & Restart instead of re-running the terminal.
~ Aman (∆☮)
