Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: can't set attributes of built-in/extension type 'NoneType' in <script> at line number 1 #8

Closed
bodiroga opened this issue Dec 5, 2017 · 5 comments

Comments

@bodiroga
Copy link

bodiroga commented Dec 5, 2017

Hi @steve-bate !

I want to try the set of decorators and functions you have developed for jython but, although I have tried lots of things in the last couple of hours, I haven't achieved anything yet. Can you help me? ;-)

This is my development environment:

  • openHAB 2.2.0 Build #1112
  • EXTRA_JAVA_OPTS="-Xbootclasspath/a:/opt/jython/jython.jar -Dpython.home=/opt/jython -Dpython.path=/etc/openhab2/lib/jython" in "/etc/default/openhab"
  • Latest SNAPSHOT version of Experimental Rule Engine installed
  • Jython installed at "/opt/jython"
  • Your "lib/openhab/ folder is placed under "/etc/openhab2/lib/jython". For example, the "log.py" file is located in "/etc/openhab2/lib/jython/openhab/log.py". I have also chowned the "lib/jython/openhab" folder and the owner of all the files is openhab:openhab.

It seems that everything is correctly setup, but if I create a demo test.py file ("/etc/openhab2/automation/jsr223/test.py") with just the following line:

from openhab.log import logging

I get the error you can see in the title:

2017-12-05 16:44:36.729 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab2/automation/jsr223/test.py': TypeError: can't set attributes of built-in/extension type 'NoneType' in <script> at line number 1

Do you have any idea about what's going on? I don't know what else I could try :(

Many many thanks for reading my message and for the code that you have contributed to this repository, it's really great!

Best regards,

Aitor

@steve-bate
Copy link
Contributor

Hello Aitor,

I haven't seen this error before. Have you tried loading an empty script and seeing if the same error occurs?

Steve

@bodiroga
Copy link
Author

bodiroga commented Dec 6, 2017

Hello Steve!

Thank you for your fast reply 👍

Yeah, I have tried with an empty script file and the log file says that the script has been loaded with no apparent error:

2017-12-06 19:28:50.316 [INFO ] [rt.internal.loader.ScriptFileWatcher] - Loading script 'test.py'

I'm going to start over with the latest stable release of openHAB (2.1.0) and see if things change a little bit. What version of openHAB2 are you using? Because I asume you are using Jython 2.7.0, right?

Thanks for your help and I will report back with my findings!

Aitor

@spacemanspiff2007
Copy link
Contributor

Hi, have you defined some items?

@bodiroga
Copy link
Author

bodiroga commented Dec 8, 2017

Wow @spacemanspiff2007, that was the problem! ✌️

Everything is working properly now, awesome! Many thanks for your help guys, time to start playing with the rules 👍

@bodiroga bodiroga closed this as completed Dec 8, 2017
@bdickenson
Copy link

Well, @spacemanspiff2007 and @steve-bate , I am not sure this should be closed. I am seeing the same symptom and I have extensive items defined in .items files. Do these have to be otherwise exposed to jython ?

Running a standalone jython 2.7.1 on RPi3. Latest (or near-latest) dev build of OH2 running under Openhabian. (NB the jython 2.7.1 full distro does not install correctly on RPi3 -- fails on setuptools installation). I have following defined in /etc/default/openhab2:

EXTRA_JAVA_OPTS="-Xbootclasspath/a:/home/openhabian/jython2.7.1/jython.jar
-Dpython.home=/etc/openhab2/lib/python/:/etc/openhab2/automation/jsr223/
-Dpython.path=/etc/openhab2/lib/python/:/etc/openhab2/automation/jsr223/
-Djython.path=/etc/openhab2/lib/python/:/etc/openhab2/automation/jsr223/ "

@bdickenson bdickenson mentioned this issue Dec 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants