Custom Break Points in Komodo

Posted by cgchoffman on 2012-10-04 14:05

How do I set and understand Komodo custom break points?


To SET a custom breakpoint in Komodo you simply right click on the line you want the breakpoint to be on then select "Add/Edit Breakpoint". That's the easy part.

For customizing custom breakpoints, take a look at Komodo Breakpoint Properties documentation.

Here is my explanation and some examples of each tab.


With a Conditional breakpoint, you set an expression that when it evaluates to true, the script will break. For the following I will set the Condition field to a%2==0

a = 0
while a < 10: #it will break here when a is 0,2,4,6,8,10
    a += 1    #you can see this in the Locals debug tab

NOTE: If you were to set the Hit Count field to "Break when hit count is a multiple of: 2" in the File tab when editing the breakpoint, you would get the opposite, eg. 1,3,5,7,9.


Watch a variable and stop when it changes

a = 0
print a
while a < 3:
    if a % 2 == 0:
        a += 1
    print a  #This will NOT break the first loop through the while.
    a += 1

Function Call

Break when the specified function is called before the breakpoint.

def foobar():   #breakpoint will break here at function start
    print "foobar will return :|"
a = 0
print a
while a < 10:
    if a % 2 == 0:
        print "foobar's going to run! WOOH!"
        a += 1

NOTE: Red dot will not appear for either Function style or Exception style breakpoints. Check breakpoints tab in bottom pane to see them.

Function Return

This is similar to Function Call, only it stops when the function returns. In the above example it would break at the last line of the function, ie. print "foobar will return :|"

And finally,


This type will break when an Exception is hit in your code and you have written code to handle that Exception and allow the script to continue running. In this example you would write TypeError in the Exception text field under the Exception tab.

a = "0"
try:       #Without an Exception breakpoint, this will run
    a += 1 #With an Exception breakpoint, it will stop here
    a = 0
print a

Hope that helped.


- Carey GC Hoffman