Is that with your script or test script or both? What happens if you remove all scripts and create a new one, without copy/paste? Maybe thereās a nonprintable character hidden in there.
Or post your script (just put .txt at the end of the name).
After the update to 2.5.6-2 jython was not started anymore. Only Javascriptā¦
I had no clue. Removed nrge. Reinstalled it. Restarted opengaan. Nothing. Tried this a few times, including a complete reboot. Javascript engine started, nut no jython. Since i donāt Knox how the engine is started, i thought, iāll look at the path. And, it was gone! I added the path, restarted OH. And up and running!
I thought an install of nrge was taking Care of the path? Anyway, everthing works again
@Suy, then you are not using the Jython add-on. Remove the core and community libraries from $OPENHAB_HOME/lib/python/, remove the Jython entries in EXTRA_JAVA_OPTS, and copy the jar to $OPENHAB_HOME/add-ons. If you donāt want to use the add-on, then please start a new topic.
I have been using the jython library almost from beginning and had long had the plan for trying this beta. Finally I decided to spent an evening spinning it all up. Previously the setup anything from straightforward. I decided to spin up a fresh install of openHAB on a fresh installed Ubuntu 20.04 Server.
The short story is that it went well and it was amazingly easy to setup. Only thing that I had problems with, was that I actually did to much configuring (EXTRA_OPTS), after some searching I found a thread where it was stated what to leave out from the usual config. After that it just started.
I have just copied the community scripts from the repo and my personal scripts from my current openHAB insatll, and its seems to work (no errors in the log)
Great work, I actually decided to use this new server for production, so I will for sure look into it. But it really looks good, and it seems to be quite easy to setup
https://www.openhab.org/docs/configuration/jsr223-jython.html ?
itās confusing⦠Thereās so much documentation in OH docs, but, not all accurateā¦
using openhabian 2.5.6-2
I looked at $OPENHAB_HOME and ⦠there no core library in it⦠so can,āt remove anything
BUT, there is a $OPENHAB_HOME/add-ons which doesnāt have a jython jar fileā¦
My jython-standalone-2.7.0.jar is located in $OPENHAB_CONF/automation/jython
So do I have to move that jar file to the $OPENHAB_HOME/add-ons library ?
Removing the JYTHON entries of EXTRA_JAVA_OPTS i can do (when I know what to do with the jar)
Iām a bit scary to remove the ācore and community librariesā as Iām not certain which libraries you mean. Theyā"re not in the $OPENHAB_HOME ā¦
updated: I looked in the openhab-helper-libraries-master.zip and saw that thereās a Core libray and in that core library is the library automation⦠I guess you mean that i have to remove the automation library.
I once followed the installion here :https://openhab-scripters.github.io/openhab-helper-libraries/Getting%20Started/Installation.html. Thereās no mention of the community libraries, so I didnāt install them (as far as i remember)
Thanks for your help. Iāll try the changes one of these days. update: probably removed the wrong libraries⦠now only javascript is loadedā¦
now, Iām copying back my backupā¦
update3
aaaah you mean: remove library community and core from \OPENHAB\openHAB-share\openhab2-conf\automation\lib\python I guess⦠(openhabian) ? update
gave up. ⦠while searching for a solution (like error import osgi⦠error, i found a jar for the addon, ā¦
info on different places⦠I know, still beta⦠But Iāll guess Iāll wait⦠Maybe some day I do a clean install, maybe that helps⦠Anyway, at the moment Iām using jython the āold wayā and thatās is working for meā¦
The DSL rule were very limiting for me, so Iām glad I can work with Jythonā¦
Iām writing my backup image to my sd card, again (takes almost 2 hours)ā¦
Iām gonna try to follow the discussions here.
I did a completely fresh OH install using Openhabian. Still getting this error. It fails on the import. This works fine on my other OH install. I have tried both the bundle here and a manual jython install. So 2 complete new OH installs, 2 different ways of installing jython and getting the same error.
Does something else have to be enabled for Datetime/Joda to work?
from core.date import seconds_between
File "<script>", line 14, in <module>
File "/etc/openhab2/automation/lib/python/core/date.py", line 43, in <module>
from org.openhab.core.library.types import DateTimeType as LegacyDateTimeType
ImportError: No module named library
"""
This is the first script to load and it will log system information to assist
with troubleshooting.
"""
import traceback
from org.slf4j import Logger, LoggerFactory
log = LoggerFactory.getLogger("org.eclipse.smarthome.model.script.Rules")
try:
from core.date import seconds_between
except:
log.error (traceback.format_exc())
from org.slf4j import LoggerFactory
LOG = LoggerFactory.getLogger("jython.Startup")
from java.lang import System
import sys
LOG.warn("\n\n\*******************************************************************************\n\ Jython version: {}.{}.{}.{}\n\ Operating system: {}\n\ OS Version: {}\n\ Java vendor: {}\n\ Java VM name: {}\n\ Java runtime name: {}\n\ Java runtime version: {}\n\ sys.path: {}\n\ *******************************************************************************\n".format( sys.version_info[0], sys.version_info[1], sys.version_info[2], sys.version_info[3], System.getProperty("os.name"), System.getProperty("os.version"), System.getProperty("java.vendor"), System.getProperty("java.vm.name"), System.getProperty("java.runtime.name"), System.getProperty("java.runtime.version"), "\n ".join(sys.path)))
What about this? No matter what I do, I cannot reproduce this, so I believe to be something in your configuration. Did you download the latest beta addon and helper libraries?
One install (that works without problem) using the manual jython setup, works fine. That is on an old celeron box,
The install I cannot get to work is on a PI4. I have tried several installs of OH, removed bindings, tried the bundled jython and manual jython, same problem.
@5iver - I have an idea. The working install is in the US, the problematic install is in Canada. Could there be different date settings that would cause this?
Are you accessing through Samba? Iām not sure if the NGRE ScriptFileWatcher picks up the file change twice when using smb like the old one did⦠havenāt used it in a long while since setting up SSH in VS Code. Something is definitely weird on your (Canadian) system.
I donāt see how regional settings would affect this. I have an update for the beta addons that Iām very close to distributing. I doubt it will help, but it will be interesting to see what happens.
Are you using the latest core scripts? Rather than modify them with your tests, create a script in /jsr223/python/personal/. Have we seen the results of the startup script when run from Canada? Iām curious about the Java version. Are you remoting into this box or the one at home?
The link in the OP is to a directory in my Google Drive and it has not changed. The contents of the directory has changed though, and it is best to use the latest from Jan 22.
The lib/python/core/date.py file I have is different from github. Replacing that file with the one on github fixed the problem.
In the OP, #4
Download the addon and copy to $OPENHAB_HOME/addons/ (see here for more details). The jar contains the core and community helper libraries, so thereās no need to copy them from the repo. However, the core scripts will need to be copied to /automation/jsr223/python/core/.
And then the reference to step 7
Include step 7, but understand that the core libraries (/automation/lib/python/core) are included in theis bundle, so the ones you copy will be ignored.
The instructions/behavior are a little confusing. But replacing the date.py file fixed the problem.