Accessible tools

Tim Chase python.list at tim.thechases.com
Sun Feb 22 14:14:24 EST 2015


On 2015-02-22 20:29, Jacob Kruger wrote:
> jaws, doesn't always cooperate perfectly with command line/console
> interface

I've heard that on multiple occasions.  Since I mostly work with
Linux, the only terminal-with-screen-reader hints I've heard involve
using TeraTerm as the SSH client with NVDA on Windows.  Sorry I can't
be of much more assistance there, since I haven't really used Windows
for years.

> this page seems to offer enough detail relating to PDB, to start
> off with anyway: https://docs.python.org/3/library/pdb.html

My generally process is as follows:

1) add the following line some place before where I want to debug:

   import pdb; pdb.set_trace()

2) run my program

3) when it hits that line of code, it drops you to the debugging
prompt

4) poke around, using "print" followed by the thing(s) I want to
inspect such as

  print dir(something)
  print my_var.some_field

5) step to the next line of code with "n" or step into a
function/method call with "s" or exit/return from the current
function/method with "r".  I'll also use "l" (ell) to list some
context around the current line so I can tell where I am in the
source code.  This is particularly helpful as I can use the
corresponding line-number(s) to jump to the same line in my editor if
I spot the offending line of code, then edit it.

very rarely, I'll actually set additional breakpoints (optionally
making them conditional) but I *always* have to look up the syntax
for that.

Hopefully that gets you at least to the point where debugging isn't
some laborious task.  Best wishes,

-tkc





More information about the Python-list mailing list