Log --debug as UTF-8 to fix charmap mapping (v2)

This commit is contained in:
Etoh 2023-02-21 20:06:04 +00:00 committed by GitHub
parent f1babdb596
commit a85a032e09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -195,13 +195,13 @@ def blackholeStdoutForFrozenWindow():
_file = None _file = None
_error = None _error = None
def write(self, text, fname='.syncplay.log', encoding='utf-8'): def write(self, text, fname='.syncplay.log'):
if self._file is None and self._error is None: if self._file is None and self._error is None:
if os.name != 'nt': if os.name != 'nt':
path = os.path.join(os.getenv('HOME', '.'), fname) path = os.path.join(os.getenv('HOME', '.'), fname)
else: else:
path = os.path.join(os.getenv('APPDATA', '.'), fname) path = os.path.join(os.getenv('APPDATA', '.'), fname)
self._file = open(path, 'a') self._file = open(path, 'a', encoding='utf-8')
# TODO: Handle errors. # TODO: Handle errors.
if self._file is not None: if self._file is not None:
self._file.write(text) self._file.write(text)