Jython scripting using steve-bate/openhab2-jython

Hi there!

I had some time looking at where the scripts runtime errors go and I found out that they get output using a print statement in an except clause where further execution stops.

I use the Karaf console to monitor the log in real time and whatever is put in a print statement will never be shown. I guess it’s always the case if starting openHAB as a service.

Anyway, after doing some modifications of the code and re-raising the exceptions things works much better here. I made PR #11.

EDIT: Adding a question:

When using a Trigger function decorator, is there a way to access the self object? E.g. to be able to use the objects logger object. (I know I could just use a Rule Decorator instead)

@time_triggered("0/10 * * * * ?")
def my_periodic_function():
    global count
    count += 1
    # If there was a way to refer to self here, I wouldn't have to
    # create a new logger object. Just curious if it's possible at all.
    # self.log.info("running periodic function: %d", count)