[SOLVED] Jython on docker?

I’ve decided to give jython a shot, but currently bit of struggling to find /etc/default/openhab2 as per here:

it’s not in docker image.
Where is actually stored this file? can’t find it anywhere

I indeed have already jython installed on docker already.

Thanks for hint

sweet, but not answering my question … (and yes I’m aware of documentation, thanks)

If it is a manual installation, it could be anywhere, What instructions did you follow to install in Docker?

Yeah, but those docs are really out of date. Here are some instructions specific to Docker (does not use /etc/default/openhab2 file)…

https://openhab-scripters.github.io/openhab-helper-libraries/Getting%20Started/Docker.html

You’ll want to become familiar with that repo, since scripted automation without the helper libraries would be extremely tedious. There is also a PR I have yet to review for a Docker installation script…

2 Likes

@5iver thanks, that helped

(I wish instalation of “future” rule engine is not that tedious as it is now …)

1 Like

Rule engines are easy. Script engines are currently complex but will be made as simple as an addon… that’s my next major effort to wrap up.

so is it worth to tinker with it now, or shall I better wait for OH addon? :slight_smile:

I meant a Jython script engine add-on that will simplify the installation. If you are running then play! Shout if you need anything! The Jython add-on could take months.

ye, it seems to having bad times on 2.5M3 Docker…

2019-09-30 23:48:46.656 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'javascript/core/000_startup_delay.js'
2019-09-30 23:49:17.795 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/000_startup_delay.py'
2019-09-30 23:49:49.310 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/components/100_DirectoryTrigger.py'
2019-09-30 23:49:51.427 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/core/components/100_DirectoryTrigger.py': ImportError: No module named configuration in <script> at line number 21
2019-09-30 23:49:51.429 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/components/100_OsgiEventTrigger.py'
2019-09-30 23:49:53.458 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/core/components/100_OsgiEventTrigger.py': ImportError: No module named configuration in <script> at line number 17
2019-09-30 23:49:53.460 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/components/100_StartupTrigger.py'
2019-09-30 23:49:55.243 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/core/components/100_StartupTrigger.py': ImportError: No module named configuration in <script> at line number 16
2019-09-30 23:49:55.244 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/components/200_JythonBindingInfoProvider.py'
2019-09-30 23:49:56.849 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/core/components/200_JythonBindingInfoProvider.py': ImportError: No module named configuration in <script> at line number 19
2019-09-30 23:49:56.850 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/components/200_JythonExtensionProvider.py'
2019-09-30 23:49:58.780 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/core/components/200_JythonExtensionProvider.py': ImportError: No module named configuration in <script> at line number 29
2019-09-30 23:49:58.781 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/components/200_JythonItemChannelLinkProvider.py'
2019-09-30 23:50:00.734 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/core/components/200_JythonItemChannelLinkProvider.py': ImportError: No module named configuration in <script> at line number 18
2019-09-30 23:50:00.743 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/components/200_JythonItemProvider.py'
2019-09-30 23:50:02.702 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/core/components/200_JythonItemProvider.py': ImportError: No module named configuration in <script> at line number 10
2019-09-30 23:50:02.708 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/components/200_JythonThingProvider.py'
2019-09-30 23:50:04.609 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/core/components/200_JythonThingProvider.py': ImportError: No module named configuration in <script> at line number 17
2019-09-30 23:50:04.610 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/components/200_JythonThingTypeProvider.py'
2019-09-30 23:50:06.439 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/core/components/200_JythonThingTypeProvider.py': ImportError: No module named configuration in <script> at line number 17
2019-09-30 23:50:06.441 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/core/components/200_JythonTransform.py'
2019-09-30 23:50:07.942 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/core/components/200_JythonTransform.py': ImportError: No module named configuration in <script> at line number 19
2019-09-30 23:50:07.951 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'python/personal/hello_world.py'
2019-09-30 23:50:11.207 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/jsr223/python/personal/hello_world.py': ImportError: No module named configuration in <script> at line number 5

not sure if it’s worth debugging, still feels quite rough for production use

You need to follow all the steps in the installation instructions. Your issue is at step 8 (rename /automation/lib/python/configuration.py.example). It looks like the docker docs need an update.

ah havent followed core instalation when on docker… will give it a shot in the evening. Thanks!

works now., thank you very much

anyway, running hello_world.py generates every 10second event.log as follows

2019-10-01 17:49:20.937 [.event.RuleStatusInfoEvent] - aa44f76f-814b-4a51-9f80-177a79c484fe updated: RUNNING
2019-10-01 17:49:20.939 [.event.RuleStatusInfoEvent] - aa44f76f-814b-4a51-9f80-177a79c484fe updated: IDLE
2019-10-01 17:49:30.938 [.event.RuleStatusInfoEvent] - aa44f76f-814b-4a51-9f80-177a79c484fe updated: RUNNING
2019-10-01 17:49:30.941 [.event.RuleStatusInfoEvent] - aa44f76f-814b-4a51-9f80-177a79c484fe updated: IDLE
2019-10-01 17:49:40.938 [.event.RuleStatusInfoEvent] - aa44f76f-814b-4a51-9f80-177a79c484fe updated: RUNNING
2019-10-01 17:49:40.940 [.event.RuleStatusInfoEvent] - aa44f76f-814b-4a51-9f80-177a79c484fe updated: IDLE
2019-10-01 17:49:50.940 [.event.RuleStatusInfoEvent] - aa44f76f-814b-4a51-9f80-177a79c484fe updated: RUNNING
2019-10-01 17:49:50.941 [.event.RuleStatusInfoEvent] - aa44f76f-814b-4a51-9f80-177a79c484fe updated: IDLE

but nothing in openhab.log eg. “Hello World!”

Where should be this entry found please? Or have I messed up something else ?

Thanks

Looks like you’re in the events.log… take a look in the openhab.log.

yes …

Check the installation instructions again. Did you set the logger?

what do you mean?
I should follow core instalation step by step for docker image?
what about karaf console as in docker there is no port 8101 exposed

You could setup Karaf for ssh, but it’s easier to use the $OPENHAB_RUNTIME/bin/client script. Another option is to edit the $OPENHAB_USERDATA/etc/org.ops4j.pax.logging.cfg file and manually add the logger.

Both are detailed in the OH documentation.

@marcel_erkel, could you please help kriznik?

that worked even in docker, thanks!
all is now working

1 Like

@kriznik

Good to see that you got it working. I was typing the following, so for future reference should anyone stumble on this while searching.

In $OPENHAB_CONF/automation/lib/python/configuration.py change the default LOG_PREFIX to:

LOG_PREFIX = "org.openhab.automation.jsr223.jython"

To access the the karaf console you can enter the container:

docker exec -ti <your-openhab-container-name> /bin/bash

and execute

/openhab/runtime/bin/client

or execute the client using:

docker exec -ti <your-openhab-container-name> /openhab/runtime/bin/client