[IronPython] IronPython exception line numbers in Gestalt

Ryan Berdeen ryan at ryanberdeen.com
Sun Mar 21 22:38:38 CET 2010

I've just started trying to use Gestalt/dlr.js. I have a simple test
script (js.py), which throws an exception, then tries to extract a
line number from the exception.

import sys

def b():
        raise Exception()
    except Exception as ex:
        exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
        return exceptionTraceback.tb_frame.f_lineno

def a():
    return b()


When run in my browser, this fails, and displays this error:

IOError: [Errno 2] Error 0x1A88.  Debugging resource strings are
unavailable. See

Line 6:     except Exception as ex:
Line 7:         exceptionType, exceptionValue, exceptionTraceback =
Line 8:         return exceptionTraceback.tb_frame.f_lineno
Line 9:
Line 10: def a():

at b in js.py, line 8
at a in js.py, line 11
at <module> in js.py, line 13

This appears to be a message telling me that line numbers are
unavailable which, paradoxically, includes all of the line numbers.
Looking through the DLR source, I see it is getting the line number
from a DynamicStackFrame
but I don't see how to get this information from Python.

I've tried setting DLR.settings.debug to true, without any effect.
What is the correct way to enable resource strings so that they are
are accessible from Python, or what else could I do to access them?



More information about the Ironpython-users mailing list