fixed datetime error

This commit is contained in:
b3yond 2017-07-20 22:44:44 +02:00
parent a2c635cbf6
commit b3fa55104c
4 changed files with 4 additions and 5 deletions

1
.gitignore vendored
View file

@ -9,4 +9,3 @@ pip-selfcheck.json
bin/ bin/
include/ include/
lib/ lib/
logs/*

View file

@ -27,7 +27,7 @@ class RetootBot(object):
if logpath: if logpath:
self.logpath = logpath self.logpath = logpath
else: else:
self.logpath = os.path.join("logs", "{%Y-%m-%d_%H:%M:%S}".format(datetime.datetime.now())) self.logpath = os.path.join("logs", str(datetime.datetime.now()))
def log(self, message, tb=False): def log(self, message, tb=False):
""" """
@ -36,7 +36,7 @@ class RetootBot(object):
:param message(string): Log message to be displayed :param message(string): Log message to be displayed
:param tb: String of the Traceback :param tb: String of the Traceback
""" """
time = "{%Y-%m-%d_%H:%M:%S}".format(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), 'w+') as f: with open(os.path.join("logs", time), 'w+') as f:

View file

@ -80,7 +80,7 @@ class RetweetBot(object):
:param message(string): Log message to be displayed :param message(string): Log message to be displayed
:param tb: String of the Traceback :param tb: String of the Traceback
""" """
time = "{%Y-%m-%d_%H:%M:%S}".format(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), 'w+') as f: with open(os.path.join("logs", time), 'w+') as f:

View file

@ -18,7 +18,7 @@ if __name__ == '__main__':
trigger = Trigger(config) trigger = Trigger(config)
logpath = os.path.join("logs", "{%Y-%m-%d_%H:%M:%S}".format(datetime.datetime.now())) logpath = os.path.join("logs", str(datetime.datetime.now()))
mbot = RetootBot(config, trigger, logpath=logpath) mbot = RetootBot(config, trigger, logpath=logpath)
tbot = RetweetBot(trigger, config, logpath=logpath) tbot = RetweetBot(trigger, config, logpath=logpath)