- have you copied the files to the python distribution?
Please list
ls -l /usr/local/lib/python2.7/dist-packages/
- try to execute python from the environment.
/usr/bin/env python2
When this works add the shebang to your script, first line.
#!/usr/bin/env python2.7
import sys
import Adafruit_DHT
sensor = Adafruit_DHT.DHT22
pin = 18
humidity, temperature = Adafruit_DHT.read_retry(sensor, pin)
if humidity is not None and temperature is not None:
print('{0:0.2f}'.format(temperature))
else:
print('Failed to get reading. Try again!')
sys.exit(1)
and execute this, please post the result.
EDIT:removed dot.
sudo -u openhab /opt/openhab2/conf/scripts/hum.py