mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Fix: UnicodeDecodeError when getting serial
This commit is contained in:
parent
c9530e7a5a
commit
7029375ca3
@ -118,7 +118,7 @@ class VirtualBoxEmulator:
|
|||||||
|
|
||||||
serial = []
|
serial = []
|
||||||
for file in vbox:
|
for file in vbox:
|
||||||
with open(file, 'r') as f:
|
with open(file, 'r', encoding='utf-8', errors='ignore') as f:
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
# <Forwarding name="port2" proto="1" hostip="127.0.0.1" hostport="62026" guestport="5555"/>
|
# <Forwarding name="port2" proto="1" hostip="127.0.0.1" hostport="62026" guestport="5555"/>
|
||||||
res = re.search('<*?hostport="(.*?)".*?guestport="5555"/>', line)
|
res = re.search('<*?hostport="(.*?)".*?guestport="5555"/>', line)
|
||||||
|
|||||||
@ -169,7 +169,7 @@ class Emulator:
|
|||||||
str: serial such as `127.0.0.1:5555`
|
str: serial such as `127.0.0.1:5555`
|
||||||
"""
|
"""
|
||||||
regex = re.compile('<*?hostport="(.*?)".*?guestport="5555"/>')
|
regex = re.compile('<*?hostport="(.*?)".*?guestport="5555"/>')
|
||||||
with open(file, 'r') as f:
|
with open(file, 'r', encoding='utf-8', errors='ignore') as f:
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
# <Forwarding name="port2" proto="1" hostip="127.0.0.1" hostport="62026" guestport="5555"/>
|
# <Forwarding name="port2" proto="1" hostip="127.0.0.1" hostport="62026" guestport="5555"/>
|
||||||
res = regex.search(line)
|
res = regex.search(line)
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class EmulatorInstance(VirtualBoxEmulator):
|
|||||||
|
|
||||||
serial = []
|
serial = []
|
||||||
for file in vbox:
|
for file in vbox:
|
||||||
with open(file, 'r') as f:
|
with open(file, 'r', encoding='utf-8', errors='ignore') as f:
|
||||||
for line in f.readlines():
|
for line in f.readlines():
|
||||||
# <Forwarding name="port2" proto="1" hostip="127.0.0.1" hostport="62026" guestport="5555"/>
|
# <Forwarding name="port2" proto="1" hostip="127.0.0.1" hostport="62026" guestport="5555"/>
|
||||||
res = re.search('<*?hostport="(.*?)".*?guestport="5555"/>', line)
|
res = re.search('<*?hostport="(.*?)".*?guestport="5555"/>', line)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user