jsolbrig at jsolbrig at
Sun May 28 20:51:16 EDT 2000

In article <ba3Y4.5208$SY5.23052 at>,
  "Reza Habib" <reza at> wrote:
> Hello.  I'm new to python and am having some trouble debugging my
> I'm running python 1.52 under windows nt 4 sp6.  I use the python
> line shell to import my script file, the pdb file, and then start the
> debugger:'myfile.test()').  This starts the debugger,
however, the
> list command only prints EOF.  Also, I can't set breakpoints by giving
> numbers (since it doesn't look like the file was loaded).  However, if
I use
> the next command, it will correctly step through my code.

Step a couple times and then try giving the line breaks. I have found
that break point within the pdb command line can be buggy. Sometimes pdb
just ignores your breaks (I submitted this as a bug some month ago -
perhaps if you have code you can isolate it in you could send it).
Also, pdb can be fairly slow, depending on your machine and size of your
code. I haven't found any trouble with list once a file is loaded - have
you tried this?

You can insert calls to the debugger (break-points) directly into your
code - just put the statement pdb.Pdb().set_trace() where you want to
stop and be sure that stdin and stdout point to the dos box you are
running the app in. This will get you to your break point fast. (The
statement pdb.set_trace() leaves you one level deeper in the stack.)
You can even add debugging logic to the code such
if foo:
   Pdb.Pdb().set_trace() #break to be removed

(The debugger supports direct conditional breaks as well).

It would be nice if the windows command line had something like doskey.
But alas. Using the command p foo.__dict__ is good for finding what is
happening with everything inside an object and creating __str__ methods
for your objects also helps.

Anyway, these are my tips. Good luck and, also I think the rest of your
questions can be answered by the documentation of the pdb module.

Joe Solbrig
python hacker available for assignment

>Is there
> something I need to do to get the list command to work so that I know
> in the code I'm debugging and also to get break points to work.
Thanks in
> advance.
> Reza

Sent via
Before you buy.

More information about the Python-list mailing list