Python script called by OpenHAB rule fails to write jpg file

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”

jpgfile = urllib2.urlopen(“”)
output = open(‘doorbell.jpg’,‘wb’)

except IOError:
print(‘An error occured trying to read the file.’)

Permission Problem ?

In Openhab is the User openhab!
Shell on Raspberry is the User Pi or for Openhabiian is the User Openhabian

This has helped me a lot. Permissions issue was correct.

1 Like