"Script Error embedded script error:
Script Error 'ascii' codec can't decode byte 0xc2 in position 7915: ordinal not in range(128)
Script Error Exception Traceback (most recent call shown last):
embedded script, line 15, at top level
File '/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/encodings/ascii.py', line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 7915: ordinal not in range(128)"
- Code: Select all
import os
from datetime import date
baseDir = indigo.server.getInstallFolderPath()
tmpFileName = os.path.join(baseDir, 'Logs/tmp.txt')
fileDate = str(date.today())
eventFileName = os.path.join(baseDir, 'Logs/' + fileDate + ' Events.txt')
theBody = ''
with open(tmpFileName, 'a') as tmpFile:
with open( eventFileName, 'r' ) as log:
for line in log:
if 'Error' in line:
tmpFile.write(line)
theBody += line
# theBody is the body of an email which is sent next
print theBody
indigo.variable.updateValue(1155409051, value=theBody)
theSubject = "All Indigo Event Log Errors"
indigo.variable.updateValue(1695073597, value=theSubject)