前提・実現したいこと
先ほど、質問して回答をいただきました。
そこで前回実行した時間を記録して下記、通過後もしくは13時間後に12時間以上過ぎているかチェックするプログラムを書きました。
if op.type == 0:
発生している問題・エラーメッセージ
[ ERROR ] 'datetime.datetime' object is not iterable
上記のようなエラーがでます。
該当のソースコード
def lineBot(op): if op.type == 0: def timer(): print("開始") end = [] now = datetime.now() if not end: end = set(now) pritn(end) print("初回") if abs(now - end) >= timedelta(hours=12): print("終了") sys.exit() threading.Timer(46800, timer) return lineBot timer()
どなたか、分かる方いらっしゃればご教授お願い致します。
追記
def lineBot(op): if op.type == 0: def timer(): print("開始") end = [] now = datetime.now() try: if abs(now - list(end)[0]) >= timedelta(seconds=1): print("終了") sys.exit() except: pass end = set([now]) print(list(end)[0]) threading.Timer(5, timer) return lineBot timer()
Python3 Centos7
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/12/10 03:20
2018/12/10 03:27
2018/12/10 03:42