forked from ticketfrei/ticketfrei
reverted so called "fix" and try-excepted the problem
This commit is contained in:
parent
1833986565
commit
3eb9321c53
|
@ -39,11 +39,15 @@ class RetootBot(object):
|
||||||
time = str(datetime.datetime.now())
|
time = str(datetime.datetime.now())
|
||||||
if tb:
|
if tb:
|
||||||
message = message + " The traceback is located at " + os.path.join("logs" + time)
|
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)
|
f.write(tb)
|
||||||
line = "[" + time + "] "+ message + "\n"
|
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)
|
f.write(line)
|
||||||
|
except UnicodeEncodeError:
|
||||||
|
self.log("Failed to save log message due to UTF-8 error. ")
|
||||||
|
traceback.print_exc()
|
||||||
print line,
|
print line,
|
||||||
|
|
||||||
def register(self):
|
def register(self):
|
||||||
|
|
|
@ -85,11 +85,15 @@ class RetweetBot(object):
|
||||||
time = str(datetime.datetime.now())
|
time = str(datetime.datetime.now())
|
||||||
if tb:
|
if tb:
|
||||||
message = message + " The traceback is located at " + os.path.join("logs" + time)
|
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)
|
f.write(tb)
|
||||||
line = "[" + time + "] "+ message + "\n"
|
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)
|
f.write(line)
|
||||||
|
except UnicodeEncodeError:
|
||||||
|
self.log("Failed to save log message due to UTF-8 error. ")
|
||||||
|
traceback.print_exc()
|
||||||
print line,
|
print line,
|
||||||
|
|
||||||
def get_history(self, path):
|
def get_history(self, path):
|
||||||
|
|
Loading…
Reference in a new issue