Python Debugging with Visual Studio Code / Gitpod.io

Debugging is the process of identifying and removing errors from computer hardware or software. Sometimes people do debugging or finding error with “print” syntax to a variable for checking it works or not, it can solve some problem, but not all of them, how if the codes are filled with a thousand line of code or the code had looping more than a thousand, u can solve it, but it maybe take a lot of time or maybe u can’t solve the problem. So i will show u how to debugging with gitpod.io . if u doesn’t have VS code u can easily download it here: https://code.visualstudio.com/download ,

after u install it, u can open the apps first and then we just jump to the code. first of all make a new file and name it “hy.py” , after that fill it with some code:

after that just press F5 to  initialize the debugger

it will auto generate as json file. and u can edit the json file as u want, such as change the file that u want to run like this

after that u can make a breakpoint on the line that u want to check, like this:

as u can see now its fulled by red circle, and then run it by clicking the green play button on the left up corner. the debugger will stop at the breakpoint that u have been made, after that u can use some feature to do debugging, as u can see it will appear the local variable msg in the local pane. On that feature too we can analyze the variable itself.

after that u can feature WATCH to try some syntax on variable, u can try it on the left side, and then click the plus button

try to to input some expression

and then the result will appear bellow the WATCH section:

u can try some expression or try the variable with some syntax that have been run like 1+1 etc. after that u can try the debug toolbar on the left top

on the left one is continue button, the second one after that is step over , after that is step into, step out, restart, and the last one is Stop. We already try to run it before and the program stop at the berakpoint, after that we can try to press continue button to see what happen next.

as u can see the terminal already done running the program and then make an output “hy world”. if u want so see the demo u can check it on this link:

  • https://youtu.be/r3F31iHgGf8

Similar Posts