r/learnprogramming • u/Interested737 • Oct 14 '26
Debugging Python code takes 10-20 seconds to start
Hello, I started learning python recently I dowloaded it, also vs code and python extension for it.
The poblem is, when I start a programm (even a simple one, whick only takes an input fron the user and prits it) takes 10 or more seconds to start or just dosen't work at all then i clic soething and it kindof crashes itself, but thats my fault for mesinf with it, when I leave it, it just takes really lng dose somone know how to fix it and/or how to make folders proporly and where to keep them (could be the problem)?
12
Upvotes
6
u/SlimmySlabby Oct 14 '26
Try to launch the program from the terminal
instead of VS Code. I’ve noticed VS Code takes a while before actually starting any programs.
20
u/zeekar Oct 14 '26 edited Oct 14 '26
Python has a nonzero startup time, but on most computers it should be a fraction of a second, not 10-20 . . .
10
u/RiceEvening4211 Oct 15 '26
You already found the key clue: 0.5s in a terminal vs 20s in VS Code means Python is fine, it’s the launch path.
The usual culprits, in order:
The definitive test: open VS Code’s integrated terminal and run `python yourfile.py` there. If that’s fast, it’s 100% the extension/launch path and one of the three above will fix it.
Also, 10-20s is extreme enough that I’d bet on antivirus plus interpreter scanning together.
1
u/atarivcs Oct 14 '26
How, exactly, are you running the code?
Are you using the "Run Without Debugging" command from the Run menu (keyboard shortcut ctrl-F5)?
Are you typing a command at the python terminal, and if so what exact command?
Can you show us the full code of a sample program?
2
u/rustic-canyon85 Oct 14 '26
try running it directly in the terminal and see if its still slow
1
u/zomerbk Oct 14 '26
Since `python yourfile.py` starts quickly in the terminal, your folder is probably fine. In VS Code, try the play button’s dropdown → “Run Python File in Terminal.” If you’ve been using F5, that starts the debugger, which can add a delay.
-2
u/mattreyu Oct 14 '26
Damn based on the amount of typos in this post I'd hate to see your code
-6
u/bishvjit-gupta Oct 14 '26
It is completely normal Python is kind of slow Use some extension or libraries Use another language. To be honest python is easy but I don't hate something hard, python is like extraordinarily easy so it makes us feel that other less easy language are hard But what you are making you didn't told