mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-13 04:27:00 +08:00
Fix: Error log char encoding set to UTF-8
82277e3d5a changed log char encoding to UTF-8 and it broke 'save_error_log'.
This commit is contained in:
6
alas.py
6
alas.py
@@ -56,15 +56,15 @@ class AzurLaneAutoScript:
|
||||
image_time = datetime.strftime(data['time'], '%Y-%m-%d_%H-%M-%S-%f')
|
||||
image = handle_sensitive_image(data['image'])
|
||||
image.save(f'{folder}/{image_time}.png')
|
||||
with open(log_file, 'r') as f:
|
||||
with open(log_file, 'r', encoding='utf-8') as f:
|
||||
start = 0
|
||||
for index, line in enumerate(f.readlines()):
|
||||
if re.search('\+-{15,}\+', line):
|
||||
start = index
|
||||
with open(log_file, 'r') as f:
|
||||
with open(log_file, 'r', encoding='utf-8') as f:
|
||||
text = f.readlines()[start - 2:]
|
||||
text = handle_sensitive_logs(text)
|
||||
with open(f'{folder}/log.txt', 'w') as f:
|
||||
with open(f'{folder}/log.txt', 'w', encoding='utf-8') as f:
|
||||
f.writelines(text)
|
||||
|
||||
def reward_when_finished(self):
|
||||
|
||||
Reference in New Issue
Block a user