The below script when executed by a OpenHAB rule fails.
When executed in console the script works perfect.
Please assist in troubleshooting.
import commands
import datetime
import time
import urllib2
import os
import smtplib
file = “doorbell.jpg”
try:
jpgfile = urllib2.urlopen(“http://192.168.1.9:9989/?action=snapshot”)
output = open(‘doorbell.jpg’,‘wb’)
output.write(jpgfile.read())
output.close()
except IOError:
print(‘An error occured trying to read the file.’)