I've been having the most awful time debugging my code under WingIDE. 
 Everything used to work fine, but I updated my copy of WingIDE and my 
web2py image and debugging went to h3ll in a handcart.

Specifically, when entering a breakpoint on my Mac, the WIngIDE interface 
would go into a "beach ball" display and would not let me enter any text in 
the "debug probe" pane.  Or I could laboriously enter text a character at a 
time but the debug probe would fail to execute it.

After seeking help from the folks at WingWare, we found the problem was 
occurring in the monkey-patched version of linecache.getline.  Adding a 
try-except block to handle errors seems to fix the problem, at least for my 
use.


    # enhance linecache.getline (used by debugger) to look at the source 
file
    # if the line was not found (under py2exe & when file was modified)
    import linecache
    py2exe_getline = linecache.getline
    def getline(filename, lineno, *args, **kwargs):
        line = py2exe_getline(filename, lineno, *args, **kwargs)
        if not line:
            try:
                f = open(filename, "r")
                try:
                    for i, line in enumerate(f):
                        if lineno == i + 1:
                            break
                    else:
                        line = None
                finally:
                    f.close()
            except (IOError, OSError):
                line = None
        return line
    linecache.getline = getline



-- Joe B.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to