[program-l] Re: How use variable watch window with python in vs code

  • From: Lubos Pintes <lubos.pintes@xxxxxxxxx>
  • To: program-l@xxxxxxxxxxxxx
  • Date: Thu, 16 Sep 2021 13:12:41 +0200

Hello the quickest way to see the variable's value is to place cursor on it and press ctrl+k, ctrl+i.

The watch window is not only for variables but also for arbitrary expression. You have to add the expressions before you can view them.

Dňa 11. 9. 2021 o 16:10 Alfredo Holguin napísal(a):

Hello,
can someone please explain to me how to use the variable watch window
to look at the value of a variable when pressing f5, and ythebreak
point is trigger one line after the variable has been assigned?

or example my code only includes:
sTest ="hello"
(break here with f9)

when I run the code with f5 and it pauses on the break point, I go to:
variable watch window with Control + shift +d, then tab to the
variable watch window.

after tabbing some, I get to debug variables and there is a tree view
for local and global variables.
However, I do not see the value of my variable.
I see a bunch of other stuff but not the value or name of my variable, sTest.

My end-goal, is to create a simple steps checklist to go through the
steps I should take when debugging, I have started it below, but
itIknow Ineed to learn how to use the variable watch window to be
effective, otherwise I will have to print them with print() and this
will degrade my productivity.

how debug quickly:
1.  Open a command prompt or power shell terminal outside of VS Code,
and navigate to the location of the folder where the files you are
currently working reside
A.  if you install extension with ID,
sandipchitale.vscode-command-window-or-terminal, you can use
application key when inside editor to get an external terminal window
B.  If you use Power shell follow these steps to quickly go to folder location
I.  When the VS Code has the editor window with the focus on the file
you would like to get the full file path for, press, Control +  k, p,
II. in the Power Shell or command prompt window type, "cd ", then
paste the contents of the clipboard, with Control + v
(((.  press the backspace button to delete the filename section from
the full file path you pasted, until you get to the first, \
(backslash).
IV.  your command line should look something similar to =       cd
C:\Users\holguin\Documents\python\Tutorial\os2\hello.py
V.  Press enter to execute the command, and make the working directory
the one where your file resides
C.  End result is that you will have 2 windows:
I.  a VS code window with your editor open on the file you are working in
II.  the command/power shell prompt with the working directory set to
the folder where the file that you are working in resides
2.  Everytime you would like to check for errors, and before running
the code in the powerShell/command prompt, press, Alt + F8
A.  If there are no errors then, NVDA will not announce anything
B.  if there are any errors NVDA will announce the errors and place
the focus on the line with the first error
I.  the character focus will most likely be at the beginning where the
interpreter first notices the error
I(.  For example if the line with the error is =        print("hello )
III.  the character focus will be on the ", before the h, of hello.
#.  make sure that all errors are corrected by correcting each error
and pressing Alt + F8, until there are no errors
A.  If there are no errors, then NVDA will not announce anything
B.  If you would like to see the entire list of error, press Control +
Shift + m, and use up and down arrow key to look through the errors
I.  Pressing enter on any of the errors in this list, will place the
focus on that error, like when pressing Alt + F8
4.  Save the file with Control + s
5.  When there are no errors in the code anymore, and you do not care
to use the variable watch window, then run the file through the
PowerShell/command prompt window
A.  Do not use the internal terminal window; do not type F5 when in VS Code
B.  Switch to the powerShell/command prompt window with Alt ++ Tab
C.  type py followed by the name of the file
I.  if your file name is, hello.py, then you would type =       py hello.py
II.  You can use tab key to auto-complete the filename in
PowerShell/command prompt
6.  When there are no errors in the code anymore, and you would like
to view the values of a variable using the Variable watch window, then
you must use VS Code
** need to learn this section **


** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: