Iam newbie to python并在运行此脚本时继续收到此错误,我已获得该文件的完全权限。
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'
我最近从MYSQL升级到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
答案 0 :(得分:1)
脚本无权写入日志文件。更改chmod
的{{1}}可以解决您的问题:
tmp/anpr_log