From b3fa55104c14b960b0d641183d03c3e6040d7ab8 Mon Sep 17 00:00:00 2001 From: b3yond Date: Thu, 20 Jul 2017 22:44:44 +0200 Subject: [PATCH] fixed datetime error --- .gitignore | 1 - retootbot.py | 4 ++-- retweetbot.py | 2 +- ticketfrei.py | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index ecafff3..cf385b2 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,3 @@ pip-selfcheck.json bin/ include/ lib/ -logs/* diff --git a/retootbot.py b/retootbot.py index d1c6fce..48c91ac 100644 --- a/retootbot.py +++ b/retootbot.py @@ -27,7 +27,7 @@ class RetootBot(object): if logpath: self.logpath = logpath 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): """ @@ -36,7 +36,7 @@ class RetootBot(object): :param message(string): Log message to be displayed :param tb: String of the Traceback """ - time = "{%Y-%m-%d_%H:%M:%S}".format(datetime.datetime.now()) + 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), 'w+') as f: diff --git a/retweetbot.py b/retweetbot.py index bd1ef31..fbae911 100644 --- a/retweetbot.py +++ b/retweetbot.py @@ -80,7 +80,7 @@ class RetweetBot(object): :param message(string): Log message to be displayed :param tb: String of the Traceback """ - time = "{%Y-%m-%d_%H:%M:%S}".format(datetime.datetime.now()) + 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), 'w+') as f: diff --git a/ticketfrei.py b/ticketfrei.py index 9fea877..266ef33 100644 --- a/ticketfrei.py +++ b/ticketfrei.py @@ -18,7 +18,7 @@ if __name__ == '__main__': 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) tbot = RetweetBot(trigger, config, logpath=logpath)