[beta testers wanted!] Jython addon w/ helper libraries (requires OH 2.5.x)

Yes Jython and the helper libraries were previously setup.
I just repeated the shutdown, clean-cache steps, etc. but still the same error when trying to import…
I am 2.5.0-1 (Release Build) and therefore only have the org.core.automation.modules.script.scriptenginefactory.jython-2.5.0-SNAPSHOT.jar dropped in /addons
My EXTRA_JAVA_OPTS is commented out…

Put this in a script and post the log…

import sys
from core.log import logging, LOG_PREFIX
LOG = logging.getLogger("{}.TEST".format(LOG_PREFIX))

LOG.warn("sys.path = {}".format(sys.path))
2019-12-16 17:42:44.800 [WARN ] [jsr223.jython.TEST                  ] - sys.path = ['/etc/openhab2/automation/lib/python', '/var/lib/openhab2/cache/org.eclipse.osgi/204/0/bundleFile/Lib', '__classpath__', '__pyclasspath__/']

This looks good. Hmmm… permissions maybe? I need to setup a new test environment anyhow, so I’ll test this out again on a clean system. Have you downloaded the jar recently (there were some updates)?

Release OH released, is it planned to add this to snapshots?

Don’t know, where would you start to check permissions?

Yes just yesterday, deleted the old prior to upgrading to 2.5.0-1 (Release Build) and pulled it again from your Google drive

I know it’s too little too late, but I finally had a chance to try this out. I updated my remote openHAB (I like to live dangerously I guess) using the latest jar file and the instructions in the OP and it worked great.

I also upgraded my Docker instance and I’ve not had good luck. The first start after copying over the jar file I got the Felix exception as expected. But I never see any indication that it tries to install the dependency and I never see my Rules loading or running. When I try to create a Rule using PaperUI, Jython is not listed, only JavaScript.

2019-12-17 14:22:04.677 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/openhab/addons/org.openhab.core.automation.module.script.scriptenginefactory.jython-2.5.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.core.automation.module.script.scriptenginefactory.jython [203]
  Unresolved requirement: Import-Package: org.openhab.core.automation.module.script; version="[2.5.0,3.0.0)"

        at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]

I’ve cleared the cache multiple times and restarted multiple times. I get the above exception every time.

My Docker instance is running 3.0 SNAPSHOT #1779.

Based on JimT’s post above #27, I renamed the jar file to 3.0.0-SNAPSHOT at the end, cleared the cache and tried again (which is a pain because every time I clear the cache it fails to load my items and I have to restart again to get a clean boot).

After renaming the jar file, I get the felix error twice.

2019-12-17 14:39:31.886 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/openhab/addons/org.openhab.core.automation.module.script.scriptenginefactory.jython-3.0.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.core.automation.module.script.scriptenginefactory.jython [203]
  Unresolved requirement: Import-Package: org.openhab.core.automation.module.script; version="[2.5.0,3.0.0)"

        at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]
2019-12-17 14:39:41.896 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/openhab/addons/org.openhab.core.automation.module.script.scriptenginefactory.jython-3.0.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.core.automation.module.script.scriptenginefactory.jython [203]
  Unresolved requirement: Import-Package: org.openhab.core.automation.module.script; version="[2.5.0,3.0.0)"

        at org.eclipse.osgi.container.Module.start(Module.java:444) ~[org.eclipse.osgi-3.12.100.jar:?]
        at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:383) ~[org.eclipse.osgi-3.12.100.jar:?]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.startAllBundles(DirectoryWatcher.java:1221) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:515) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.4]
        at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.4]

I’m not sure what the next steps should be.

Do you have the NGRE installed?

Which version of OH worked for you?

Yes, I have NGRE installed. 2.5 release installed through apt is the one that worked.

The name of the file can be anything. I’m wondering about S1779. I’m still on S1778 and will upgrade in a bit. We just upgraded server hardware and still have some things to sort out first.

I don’t know what this means but I found it interesting and is the reason why I tried to change the name of the file. I’m surprised to see it list both 2.5 and 3.0. I’ll wait to see what develops. Thankfully it’s supper easy for me to go back to the old way. I just need to comment/uncomment one line in an ansible playbook and I can add/remove the EXTRA_JAVA_OPTS that points it to the jar file I have mounted to the container or have it try to use the jar file.

1 Like

This is a version range and the max is not inclusive due to the closing parenthesis. I reproduced the issue in a fresh S1779 test environment. I’ve put up another build that corrects this. Select the version that matches your version of OH.

I think I saw this after clearing cache, but not in subsequent restarts.

The 3.0.0 jar file appears to work as expected. Thanks! This is a great leap forward for overall usability.

1 Like

I’m a bit late to this but have unexpectedly found some spare time for non-Christmas stuff. I followed the steps and upon restarting OH (a brand new installation of OH 2.5 on a brand new Ubuntu 19.10 VM) this was output in the log:

2019-12-22 17:03:50.020 [DEBUG] [.AutomationResourceBundlesEventQueue] - Process bundle event 2, for automation bundle 'org.openhab.core.automation'
2019-12-22 17:03:50.031 [DEBUG] [.AutomationResourceBundlesEventQueue] - Process bundle event 32, for automation bundle 'org.openhab.core.automation.module.script.rulesupport'
2019-12-22 17:03:50.075 [DEBUG] [vider.AbstractResourceBundleProvider] - Parse rules from bundle 'org.openhab.core.automation'
2019-12-22 17:03:50.075 [DEBUG] [vider.AbstractResourceBundleProvider] - Parse rules from bundle 'org.openhab.core.automation.module.script.rulesupport'
2019-12-22 17:03:50.144 [DEBUG] [e.automation.internal.RuleEngineImpl] - ModuleHandlerFactory added CoreModuleHandlerFactory
2019-12-22 17:03:50.144 [DEBUG] [e.automation.internal.RuleEngineImpl] - ModuleHandlerFactory added EphemerisModuleHandlerFactory
2019-12-22 17:03:50.144 [DEBUG] [e.automation.internal.RuleEngineImpl] - ModuleHandlerFactory added TimerModuleHandlerFactory
2019-12-22 17:03:50.145 [DEBUG] [e.automation.internal.RuleEngineImpl] - ModuleHandlerFactory added AnnotatedActionModuleTypeProvider
2019-12-22 17:03:50.165 [DEBUG] [e.automation.internal.RuleEngineImpl] - ModuleHandlerFactory added AnnotatedThingActionModuleTypeProvider
2019-12-22 17:03:50.184 [DEBUG] [e.automation.internal.RuleEngineImpl] - ModuleHandlerFactory added MediaModuleHandlerFactory
2019-12-22 17:03:53.015 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Initialized a custom ScriptEngineFactory for jython (2.7.0): supports python (2.7) with file extensions [py], names [python, jython], and mimetypes [text/python, application/python, text/x-python, application/x-python]
2019-12-22 17:03:53.293 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Initialized a generic ScriptEngineFactory for Oracle Nashorn (1.8.0_232-b18): supports ECMAScript (ECMA - 262 Edition 5.1) with file extensions [js], names [nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript], and mimetypes [application/javascript, application/ecmascript, text/javascri
pt, text/ecmascript]
2019-12-22 17:03:53.302 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Initialized a custom ScriptEngineFactory for Oracle Nashorn (1.8.0_232-b18): supports ECMAScript (ECMA - 262 Edition 5.1) with file extensions [js], names [nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript], and mimetypes [application/javascript, application/ecmascript, text/javascrip
t, text/ecmascript]
2019-12-22 17:03:53.303 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Removed JythonScriptEngineFactory
2019-12-22 17:03:53.304 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Removed GenericScriptEngineFactory
2019-12-22 17:03:53.304 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Removed NashornScriptEngineFactory
2019-12-22 17:03:53.312 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Initialized a custom ScriptEngineFactory for jython (2.7.0): supports python (2.7) with file extensions [py], names [python, jython], and mimetypes [text/python, application/python, text/x-python, application/x-python]
2019-12-22 17:03:53.315 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Initialized a generic ScriptEngineFactory for Oracle Nashorn (1.8.0_232-b18): supports ECMAScript (ECMA - 262 Edition 5.1) with file extensions [js], names [nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript], and mimetypes [application/javascript, application/ecmascript, text/javascri
pt, text/ecmascript]
2019-12-22 17:03:53.319 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Initialized a custom ScriptEngineFactory for Oracle Nashorn (1.8.0_232-b18): supports ECMAScript (ECMA - 262 Edition 5.1) with file extensions [js], names [nashorn, Nashorn, js, JS, JavaScript, javascript, ECMAScript, ecmascript], and mimetypes [application/javascript, application/ecmascript, text/javascrip
t, text/ecmascript]
2019-12-22 17:03:53.320 [DEBUG] [e.automation.internal.RuleEngineImpl] - ModuleHandlerFactory added ScriptModuleHandlerFactory
2019-12-22 17:03:53.341 [DEBUG] [e.automation.internal.RuleEngineImpl] - ModuleHandlerFactory added ScriptedCustomModuleHandlerFactory
2019-12-22 17:03:53.343 [DEBUG] [e.automation.internal.RuleEngineImpl] - ModuleHandlerFactory added ScriptedPrivateModuleHandlerFactory
2019-12-22 17:04:18.352 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'javascript/core/000_startup_delay.js'
2019-12-22 17:04:18.497 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'js' with identifier: file:/etc/openhab2/automation/jsr223/javascript/core/000_startup_delay.js
2019-12-22 17:04:18.526 [INFO ] [jsr223.javascript.core.startup_delay] - Checking for initialized context
2019-12-22 17:04:18.537 [INFO ] [jsr223.javascript.core.startup_delay] - Context initialized... waiting 30s before allowing scripts to load
2019-12-22 17:04:48.547 [INFO ] [jsr223.javascript.core.startup_delay] - Complete
2019-12-22 17:04:48.548 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/000_startup_delay.py'
2019-12-22 17:04:48.549 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/000_startup_delay.py
2019-12-22 17:04:48.576 [INFO ] [jsr223.jython.core.startup_delay    ] - Checking for initialized context
2019-12-22 17:04:48.577 [INFO ] [jsr223.jython.core.startup_delay    ] - Context initialized... waiting 30s before allowing scripts to load
2019-12-22 17:05:18.578 [INFO ] [jsr223.jython.core.startup_delay    ] - Complete
2019-12-22 17:05:18.578 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/components/100_DirectoryTrigger.py'
2019-12-22 17:05:18.579 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/100_DirectoryTrigger.py
2019-12-22 17:05:18.995 [INFO ] [23.jython.core.DirectoryEventTrigger] - TriggerHandler added [jsr223.DirectoryTrigger]
2019-12-22 17:05:18.997 [INFO ] [23.jython.core.DirectoryEventTrigger] - TriggerType added [jsr223.DirectoryTrigger]
2019-12-22 17:05:18.998 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/components/100_OsgiEventTrigger.py'
2019-12-22 17:05:18.998 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/100_OsgiEventTrigger.py
2019-12-22 17:05:19.128 [INFO ] [jsr223.jython.core.OsgiEventTrigger ] - TriggerHandler added [jsr223.OsgiEventTrigger]
2019-12-22 17:05:19.129 [INFO ] [jsr223.jython.core.OsgiEventTrigger ] - TriggerType added [jsr223.OsgiEventTrigger]
2019-12-22 17:05:19.135 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/components/100_StartupTrigger.py'
2019-12-22 17:05:19.136 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/100_StartupTrigger.py
2019-12-22 17:05:19.151 [INFO ] [jsr223.jython.core.StartupTrigger   ] - TriggerHandler added [jsr223.StartupTrigger]
2019-12-22 17:05:19.152 [INFO ] [jsr223.jython.core.StartupTrigger   ] - TriggerType added [jsr223.StartupTrigger]
2019-12-22 17:05:19.153 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/components/200_JythonBindingInfoProvider.py'
2019-12-22 17:05:19.153 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonBindingInfoProvider.py
2019-12-22 17:05:19.199 [DEBUG] [thonBindingInfoProvider.scriptLoaded] - Registered service
2019-12-22 17:05:19.200 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/components/200_JythonExtensionProvider.py'
2019-12-22 17:05:19.201 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonExtensionProvider.py
2019-12-22 17:05:19.435 [DEBUG] [.jython.core.JythonExtensionProvider] - Start init
2019-12-22 17:05:19.444 [DEBUG] [.jython.core.JythonExtensionProvider] - End init
2019-12-22 17:05:19.446 [DEBUG] [JythonExtensionProvider.scriptLoaded] - Registered service
2019-12-22 17:05:19.447 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/components/200_JythonItemChannelLinkProvider.py'
2019-12-22 17:05:19.448 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonItemChannelLinkProvider.py
2019-12-22 17:05:19.470 [DEBUG] [ItemChannelLinkProvider.scriptLoaded] - Registered service
2019-12-22 17:05:19.471 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/components/200_JythonItemProvider.py'
2019-12-22 17:05:19.471 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonItemProvider.py
2019-12-22 17:05:19.498 [DEBUG] [core.JythonItemProvider.scriptLoaded] - Registered service
2019-12-22 17:05:19.499 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/components/200_JythonThingProvider.py'
2019-12-22 17:05:19.499 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonThingProvider.py
2019-12-22 17:05:19.521 [DEBUG] [ore.JythonThingProvider.scriptLoaded] - Registered service
2019-12-22 17:05:19.523 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/components/200_JythonThingTypeProvider.py'
2019-12-22 17:05:19.523 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonThingTypeProvider.py
2019-12-22 17:05:19.545 [DEBUG] [JythonThingTypeProvider.scriptLoaded] - Registered service
2019-12-22 17:05:19.545 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/core/components/200_JythonTransform.py'
2019-12-22 17:05:19.546 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/core/components/200_JythonTransform.py
2019-12-22 17:05:19.569 [DEBUG] [onTransformationService.scriptLoaded] - Registered service
2019-12-22 17:05:19.570 [INFO ] [me.core.service.AbstractWatchService] - Loading script 'python/personal/hello_world.py'
2019-12-22 17:05:19.570 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/etc/openhab2/automation/jsr223/python/personal/hello_world.py
2019-12-22 17:05:20.274 [DEBUG] [jsr223.jython.core.triggers         ] - when: target=[Time cron 0/10 * * * * ?], target_type=Time, trigger_target=cron, trigger_type=0/10 * * * * ?, old_state=None, new_state=None
2019-12-22 17:05:20.740 [DEBUG] [jsr223.jython.core.triggers         ] - when: Created cron_trigger: [Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29]
2019-12-22 17:05:20.742 [DEBUG] [jsr223.jython.core.rules            ] - Added rule [Jython Hello World (cron decorators)]
2019-12-22 17:05:20.794 [DEBUG] [le.handler.GenericCronTriggerHandler] - Scheduled cron job '0/10 * * * * ?' for trigger 'Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29_3c5cf9c024dd11eaa3953bce3edefe29'.
2019-12-22 17:05:30.786 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29_3c5cf9c024dd11eaa3953bce3edefe29' of rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is triggered.
2019-12-22 17:05:30.796 [INFO ] [Jython Hello World (cron decorators)] - Hello World!
2019-12-22 17:05:30.797 [DEBUG] [e.automation.internal.RuleEngineImpl] - The rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is executed.
2019-12-22 17:05:40.788 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29_3c5cf9c024dd11eaa3953bce3edefe29' of rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is triggered.
2019-12-22 17:05:40.788 [INFO ] [Jython Hello World (cron decorators)] - Hello World!
2019-12-22 17:05:40.789 [DEBUG] [e.automation.internal.RuleEngineImpl] - The rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is executed.
2019-12-22 17:05:50.789 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29_3c5cf9c024dd11eaa3953bce3edefe29' of rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is triggered.
2019-12-22 17:05:50.790 [INFO ] [Jython Hello World (cron decorators)] - Hello World!
2019-12-22 17:05:50.790 [DEBUG] [e.automation.internal.RuleEngineImpl] - The rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is executed.
2019-12-22 17:06:00.789 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29_3c5cf9c024dd11eaa3953bce3edefe29' of rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is triggered.
2019-12-22 17:06:00.790 [INFO ] [Jython Hello World (cron decorators)] - Hello World!
2019-12-22 17:06:00.790 [DEBUG] [e.automation.internal.RuleEngineImpl] - The rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is executed.
2019-12-22 17:06:10.790 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29_3c5cf9c024dd11eaa3953bce3edefe29' of rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is triggered.
2019-12-22 17:06:10.791 [INFO ] [Jython Hello World (cron decorators)] - Hello World!
2019-12-22 17:06:10.791 [DEBUG] [e.automation.internal.RuleEngineImpl] - The rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is executed.
2019-12-22 17:06:20.790 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29_3c5cf9c024dd11eaa3953bce3edefe29' of rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is triggered.
2019-12-22 17:06:20.791 [INFO ] [Jython Hello World (cron decorators)] - Hello World!
2019-12-22 17:06:20.791 [DEBUG] [e.automation.internal.RuleEngineImpl] - The rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is executed.
2019-12-22 17:06:30.790 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29_3c5cf9c024dd11eaa3953bce3edefe29' of rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is triggered.
2019-12-22 17:06:30.792 [INFO ] [Jython Hello World (cron decorators)] - Hello World!
2019-12-22 17:06:30.793 [DEBUG] [e.automation.internal.RuleEngineImpl] - The rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is executed.
2019-12-22 17:06:40.791 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29_3c5cf9c024dd11eaa3953bce3edefe29' of rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is triggered.
2019-12-22 17:06:40.792 [INFO ] [Jython Hello World (cron decorators)] - Hello World!
2019-12-22 17:06:40.793 [DEBUG] [e.automation.internal.RuleEngineImpl] - The rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is executed.
2019-12-22 17:06:50.791 [DEBUG] [e.automation.internal.RuleEngineImpl] - The trigger 'Time_cron_0_10_3c19af2e24dd11ea80933bce3edefe29_3c5cf9c024dd11eaa3953bce3edefe29' of rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is triggered.
2019-12-22 17:06:50.792 [INFO ] [Jython Hello World (cron decorators)] - Hello World!
2019-12-22 17:06:50.792 [DEBUG] [e.automation.internal.RuleEngineImpl] - The rule '44c72662-ad6a-4865-a30d-f5d1b2b24ed9' is executed.

All looks good to me, this is awesome, thanks!

1 Like

All testing will be helpful until the PR is merged. Thank you!

I know I’m too late to provide meaningfull input for this Jython addon, but I just wanted to say THANKS to you Scott (@5iver) for all your work. I recently started translating DSL rules and creating new Python rules and although I still have a lot to learn about the HL’s, it is quite a relieve to work with a ‘real programming language’ for scripted automation!

I run a Docker config and after removing the manual install in the Dockerfile, removing the JAVA_EXTRA_OPTS, removing the unused folders in /automation, and placing the .jar in the addons folder, it simply worked (meaning, my Jython stuff started running).

One thing I noticed is that a /packages folder is created inside /conf. I suppose that will just be recreated in case I deploy a new OH/Docker configuration, right?

Until the PR is merged, all feedback is very helpful… thank you!

I’ve not seen this, but I haven’t tested in docker. The bundle shouldn’t be creating any directories.

Same happened here not using docker. Inside the folder are 26 .pkc files.

I have OH 2.5 on Windows 10, Oracle java jdk1.8.0_211, I installed Jython addon helper libraries and the rule engine (experimental). I followed the instructions listed in [beta testers wanted!] Jython addon w/ helper libraries (requires OH 2.5) and those indicated there on links. However, the hello_world.py script is not automatically activated and I have to edit it and then save it for this to happen. However, it immediately goes into error:

2019-12-30 11: 02: 26.801 [INFO] [me.core.service.AbstractWatchService] - Loading script 'python/personal/hello_world.py'

2019-12-30 11: 02: 26.801 [DEBUG] [ipt.internal.ScriptEngineManagerImpl] - Added ScriptEngine for language 'py' with identifier: file:/D:/openHAB2/conf/automation/jsr223/python/personal/hello_world.py

2019-12-30 11: 02: 26.820 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/D:/openHAB2/conf/automation/jsr223/python/personal/hello_world.py': ImportError: No module named _FunctionRule in <script> at line number 5

Anyone know by chance if jython has any problem loading scripts automatically in windows 10?

Thank you very much