I have the following codes which will be running 24 hours but only after 10-20 minutes I get error maximum recursion depth reached. My code is folowing
def startEnd():
flag = 0
f = open('file')
lq = f.readlines()
cur2 = lq[0]
cur1 = datetime.datetime.now()
while flag == 0:
if cur1 == cur2: # cur2 is datetime read from file
q.put(True)
flag = 1
else:
flag = 0
startEnd()
How can I avoid recursion in the following code? I need to come out of while loop since cur2 value changes.
My other question is that will following code will also lead to recursion depth error in the long run since my code need to be run 24 hours.
def planIncr():
f=open('input.txt')
lines=f.readlines()
cycle_time = int(lines[1])
f.close()
q2.put(True)
threading.Timer(cycle_time, planIncr).start()
cur1weren't a different type fromcur2, it would never go from not being equal to suddenly being equal. You'd just keep settingflag = 0forever.