Permalink
Browse files

fix logfd.write on Python3 #106

  • Loading branch information...
fffonion committed Sep 13, 2017
1 parent 22d2741 commit 2d132f8ddf7325cbf8c03cbb5d263b60dea68e12
Showing with 6 additions and 3 deletions.
  1. +6 −3 swjsq.py
View
@@ -176,10 +176,13 @@ def long2hex(l):
def print(s, **kwargs):
line = "%s %s" % (time.strftime('%X', time.localtime(time.time())), s)
try:
logfd.write(line)
except UnicodeEncodeError:
if PY3K:
logfd.write(line.encode('utf-8'))
else:
try:
logfd.write(line)
except UnicodeEncodeError:
logfd.write(line.encode('utf-8'))
if PY3K:
logfd.write(b'\n')
else:

0 comments on commit 2d132f8

Please sign in to comment.