Iam newbie to python and keep on getting this error when run this script, I have given full permission to the file.
Traceback (most recent call last):
File "/usr/local/bin/ftp_site.py", line 3, in <module>
import anprint
File "/usr/local/bin/anprint.py", line 17, in <module>
hdlr = logging.FileHandler(LOG_FILENAME)
File "/usr/lib/python2.7/logging/__init__.py", line 897, in __init__
StreamHandler.__init__(self, self._open())
File "/usr/lib/python2.7/logging/__init__.py", line 916, in _open
stream = open(self.baseFilename, self.mode)
IOError: [Errno 13] Permission denied: '/tmp/anpr_log'
I have recently upgraded from MYSQL to mariadb.
Script : anprint.py
def all_in_cam_ids_by_site_id(self,site_id):
ret_list =[]
sql = """SELECT .......WHERE carparks.id = "%s" AND in_out = 1 """ % site_id
ret_val = self.cursor.execute(sql)
if (ret_val > 0):
ret_array = self.cursor.fetchall()
for retId in ret_array:
ret_list.append(retId[0])
else:
logging.error("No Cameras for Site id %s", site_id)
return ret_list
Script has no permission to write into log file. Changing chmod of tmp/anpr_log should fix your issue:
sudo chmod +rw /tmp/anpr_log
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With