I am running a Python script on a Windows machine that needs to exit from the while loop when timeout is reached or flag is True:
import time
start_time = time.time()
flag = False
timeout = 5
while time.time() < timeout + start_time:
# DO something
flag = True
break
if flag is False:
print(f"Timeout reached {timeout}")
With the current code, the timeout or the flag are not hit. Any hints of what it is wrong?