mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-17 07:35:25 +08:00
Merge pull request #182 from noname94/patch
Fix: Error log char encoding set to UTF-8
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_time = datetime.strftime(data['time'], '%Y-%m-%d_%H-%M-%S-%f')
|
||||||
image = handle_sensitive_image(data['image'])
|
image = handle_sensitive_image(data['image'])
|
||||||
image.save(f'{folder}/{image_time}.png')
|
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
|
start = 0
|
||||||
for index, line in enumerate(f.readlines()):
|
for index, line in enumerate(f.readlines()):
|
||||||
if re.search('\+-{15,}\+', line):
|
if re.search('\+-{15,}\+', line):
|
||||||
start = index
|
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 = f.readlines()[start - 2:]
|
||||||
text = handle_sensitive_logs(text)
|
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)
|
f.writelines(text)
|
||||||
|
|
||||||
def reward_when_finished(self):
|
def reward_when_finished(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user