このコードを実行しようとすると、Debianでエラーが発生しますが、Windowsでは機能します。
def checkTime():
while True:
with open('date.txt') as tar:
target = tar.read()
current = str(datetime.strptime(str(date.today()),'%Y-%m-%d'))[:-9]
if datetime.strptime(current, '%Y-%m-%d') >= datetime.strptime(target, '%Y-%m-%d'):
doSomething()
sleep(10)
それは私にこのエラーを与えます:
File "/usr/lib/python2.6/_strptime.py", line 328, in _strptime
data_string[found.end():])
ValueError: unconverted data remains:
date.txtに含まれるもの:
2013-03-21
両方のシステムの日付と時刻の設定はまったく同じです。