mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Windows: Fix UTF-8 en/decode.
This commit is contained in:
1 parent
502c2240f7
commit
50ae49c0ec
2 files changed
+9
-3
No files matched your search
@@ -20,7 +20,7 @@ import os
|
||||
import logging
|
||||
|
||||
from datetime import datetime
|
||||
from tools import timer, parse_command_line, get_version
|
||||
from tools import timer, parse_command_line, get_version, logger_exception
|
||||
|
||||
try:
|
||||
# Installation allow Unix-like signal
|
||||
@@ -271,12 +271,15 @@ class CommandLineSolver(AbstractSolver):
|
||||
return True
|
||||
|
||||
def _data_ready(self):
|
||||
try:
|
||||
# Read process output and put lines in queue
|
||||
s = self._process.readAll().data().decode()
|
||||
s = self._process.readAll().data().decode('utf-8', "replace")
|
||||
|
||||
if self._output is not None:
|
||||
for x in s.split('\n'):
|
||||
self._output.put(x)
|
||||
except Exception as e:
|
||||
logger_exception(e)
|
||||
|
||||
def _finished(self, study, exit_code, exit_status):
|
||||
if self._output is not None:
|
||||
|
||||
@@ -296,10 +296,13 @@ class SolverLogWindow(PamhyrWindow):
|
||||
while self._output.qsize() != 0:
|
||||
s = self._output.get()
|
||||
|
||||
try:
|
||||
if type(s) is str and "[ERROR]" in s:
|
||||
self._log(s, color="red")
|
||||
self._log(s.encode("utf-8"), color="red")
|
||||
else:
|
||||
self._log(s)
|
||||
except Exception as e:
|
||||
logger_exception(e)
|
||||
|
||||
####################
|
||||
# Process controle #
|
||||
|
||||
Reference in new issue
Block a user