Skip to content

Commit

Permalink
<fix> fix unable to read log due to UnicodeEncodeError
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymousException committed May 27, 2024
1 parent 10711bf commit 1848ab6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/game_unpacker_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def __init__(self, dir, p, is_auto_close):
def run(self):
try:
if self.is_auto_close and self.p is not None:
subprocess.Popen("taskkill /F /T /PID " + self.p, shell=False, stdout=my_log.f, stderr=my_log.f,
subprocess.Popen("taskkill /F /T /PID " + self.p, shell=False,
creationflags=0x08000000, text=True)
dir = self.dir
bat = '"' + os.getcwd() + '/UnRen-forall.bat' + '"'
Expand Down
11 changes: 9 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,8 +487,15 @@ def __del__(self):
self.wait()

def run(self):
f = io.open(log_path, 'r+')
self.update_date.emit(f.read())
f = io.open(log_path, 'r+',encoding='utf-8')
try:
self.update_date.emit(f.read())
except Exception as e:
f.close()
f = io.open(log_path, 'w')
f.write('Log Format UnicodeEncodeError! Log Cleared')
f.close()
f = io.open(log_path, 'r+', encoding='utf-8')
f.close()

def select_file(self):
Expand Down

0 comments on commit 1848ab6

Please sign in to comment.