reverted so called "fix" and try-excepted the problem

This commit is contained in:
b3yond 2017-07-25 15:13:54 +02:00
parent 1833986565
commit 3eb9321c53
2 changed files with 14 additions and 6 deletions

View file

@ -39,11 +39,15 @@ class RetootBot(object):
time = str(datetime.datetime.now())
if tb:
message = message + " The traceback is located at " + os.path.join("logs" + time)
with open(os.path.join("logs", time, encoding='utf-8'), 'w+') as f:
with open(os.path.join("logs", time), 'w+') as f:
f.write(tb)
line = "[" + time + "] "+ message + "\n"
with open(self.logpath, 'a', encoding='utf-8') as f:
with open(self.logpath, 'a') as f:
try:
f.write(line)
except UnicodeEncodeError:
self.log("Failed to save log message due to UTF-8 error. ")
traceback.print_exc()
print line,
def register(self):

View file

@ -85,11 +85,15 @@ class RetweetBot(object):
time = str(datetime.datetime.now())
if tb:
message = message + " The traceback is located at " + os.path.join("logs" + time)
with open(os.path.join("logs", time, encoding='utf-8'), 'w+') as f:
with open(os.path.join("logs", time), 'w+') as f:
f.write(tb)
line = "[" + time + "] "+ message + "\n"
with open(self.logpath, 'a', encoding='utf-8') as f:
with open(self.logpath, 'a') as f:
try:
f.write(line)
except UnicodeEncodeError:
self.log("Failed to save log message due to UTF-8 error. ")
traceback.print_exc()
print line,
def get_history(self, path):