I am trying to use python with my Raspberry Pi 3 to toggle some LED lights I have using openHAB. The problem is when I try to run the python code I get an error and can't figure out what the cause it.
My python is
from openhab import openHAB
base_url = 'http://<ip>:8080/rest'
items = openhab.fetch_all_items()
print("Finished")
When I run the code I it says
Traceback (most recent call last):
File "/home/pi/Desktop/Test.py", line 1, in <module>
from openhab import openHAB
ImportError: No module named 'openhab'
When I use python 2.7 I get this error
Traceback (most recent call last): File "/home/pi/Desktop/Test.py", line 1, in from openhab import openHAB File "/home/pi/.local/lib/python2.7/site-packages/openhab/init.py", line 1, in from .client import openHAB, OpenHAB File "/home/pi/.local/lib/python2.7/site-packages/openhab/client.py", line 40 def init(self, base_url: str, ^ SyntaxError: invalid syntax
I've tried searching google but can't find any solutions that have worked for me.
I have installed openHAB and Python openHAB on my Raspberry Pi.