windows fails to open utf-8 files as utf-8

This commit is contained in:
j 2019-02-20 18:22:20 +05:30
commit 41d90e1736
2 changed files with 5 additions and 4 deletions

View file

@ -1,4 +1,5 @@
# -*- coding: utf-8 -*-
import codecs
import json
import os
import time
@ -52,7 +53,7 @@ class Peer(object):
def apply_log(self):
changes = []
if os.path.exists(self._logpath):
with open(self._logpath) as fd:
with codecs.open(self._logpath, 'r', encoding='utf-8') as fd:
for line in fd:
if line:
try: