fixed datetime error
This commit is contained in:
parent
a2c635cbf6
commit
b3fa55104c
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -9,4 +9,3 @@ pip-selfcheck.json
|
|||
bin/
|
||||
include/
|
||||
lib/
|
||||
logs/*
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue