Upgrade to 4.3, python includes missing

Hi all,
after the update from 4.1 to 4.3, the python rules with
from org.openhab.core.date import seconds_between
are producing the error: ImportError: No module named date in
I tried a lot, but I’m not able to get it running again.

It’s a openhabian installation on a raspberry.

Any help is welcome.

Thanks in advance
Matthias

I don’t know why that class was imported and I don’t know when OH dropped that class but what I can say is that openHAB no longer has an org.openhab.core.date packge to import anything from. You’ll have to determine what was being imported and what it’s used for and implement an alternative, maybe by importing and using something from java.time.Duration.

The Jython helper libraries are no longer maintained. The Jython add-on itself has found a new maintainer but they are going a different direction with the helper libraries and I don’t think that his work is complete and ready for testing. So for the time being you are on your own when it comes to Jython helper library stuff.

If you are just getting started with OH (since this is your first post) you should consider starting with JS Scripting, jRuby, or if you really like Python HABApp to get by until the new Jython helper library matures a bit. Or you could even help out with the work on the new helper library.

I’m using the Jython helper libraries.

Thanks for the infos - I’m using OH since 4 years - and got many rules working with python.
As I’m an experienced programmer (Pascal, C++, Perl, SQL, PHP, … ) - and of course don’t be a fan of python, but with OH3 I found it the most suitable alternative - I’ll try to switch over to JavaScript.
I’ll post again, when the rule is successfull running…

Oh: I’ll have a look at the code of the helper libs, as soon as I got enough time.
Maybe this could be my next open source “project”.

If you want to work on the python helper library, it might be a good idea to co-ordinate it with the others who might also be working on it too.

Also this might be of interest

Hey,
I don’t know why I choosed Python as the scripting language 4 years ago. Now I’ve got more than 5000 lines of code for the rules in python - but there were lot’s of problems that took a long time for beeing solved.
Now I started with one of rules, that are not running any more, to rewrite it in JavaScript.
A good decission to change. It’s lot easier.

In the next weeks I’ll move to JS for all my rules (more than 100).

Thanks for your help! :star_struck:

Matthias

If you run into trouble please ask for help.

In addion to @jimtng’s link, Design Pattern: Working with Groups in Rules includes compatable examples in most of the rules languages for ways of looping through, filtering, map/reduce, for lists which is a very common thing one needs to do in rules. Python with it’s list comprehension syntax is a bit different from most languages but there are equivalents in all the languages and they usually don’t require for loops.

I’m guessing you’ve seen this?