Python PDB conditional breakpoint

T

Tom P

I can't get conditional breakpoints to work. I have a variable ID and I
want to set a breakpoint which runs until ID==11005.

Here's what happens -


-> import sys
....
(Pdb) b 53, ID==11005
Breakpoint 1 at /home/tom/Desktop/BEST Tmax/MYSTUFF/sqlanalyze3.py:53
(Pdb) b
Num Type Disp Enb Where
1 breakpoint keep yes at /home/tom/Desktop/BEST
Tmax/MYSTUFF/sqlanalyze3.py:53
stop only if ID==11005

(Pdb) l
50 for ID in distinct_IDs:
51 cursr.execute("select Date, Temperature from data where
StationID = ? and Date > 1963", ID)
52 datarecords = cursr.fetchall() # [(date, temp),..]
53 B-> ll = len(datarecords)
54 if ll > 150: # and len(results) < 100 :

(Pdb) c
....
std_error too large -132.433 61.967 10912
std_error too large -133.36274 62.2165 10925
std_error too large -137.37 62.82 10946
std_error too large -138.217 64.45 10990
std_error too large -138.32 65.35 11005
std_error too large -138.32 65.35 11005
std_error too large -138.32 65.35 11005
std_error too large -138.32 65.35 11005
std_error too large -134.86625 67.415 11036
std_error too large -135.0 68.22908 11053
....

- in other words it doesn't stop even though the value ID == 11005
shows up. Am I specifying the condition incorrectly?

This is Python 2.7.4, Linux 64 bit.
 
T

Tom P

On 06.11.2013 16:14, Tom P wrote:

ok I figured it. ID is a tuple, not a simple variable.
The correct test is ID[0]==11005
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top