Debugging JSR223 jython scripts

Is there a way to get line numbers when a jython script errors? I am just starting out writing rules in jython and I frequently get the unhelpful message

`Error while executing rule: org.python.proxies.__builtin__$MyRuleClass$64@10ae8dd7
org.python.core.PyException: null`

With no line number all I can do is litter my code with log statements until I figure out what I messed up. Is there an easier debug workflow for jython?

Usually traceback will give better information. For example,

import traceback

   # run some code
   oh.logError("logger_name", traceback.format_exc())

Where “logger_name” can be anything you want for the Logback log category. I have a base class that wraps the execute method with code like this.