Here is a short program which is giving me an error I'm having a difficult time understanding:
import time
TIMEOUT_LENGTH = 0.4
TIMEOUT_CHECK = False
STOPPED = True
timeout = 0.0
def start_timer():
global timeout
global STOPPED
global TIMEOUT_CHECK
TIMEOUT_CHECK = False
STOPPED = False
timeout = time.time() + TIMEOUT_LENGTH
def stop_timer():
global STOPPED
global TIMEOUT_CHECK
TIMEOUT_CHECK = False
STOPPED = True
def timeout():
global timeout
global STOPPED
global TIMEOUT_CHECK
currTime = time.time()
if (currTime > timeout) and (STOPPED == False):
TIMEOUT_CHECK = True
return TIMEOUT_CHECK
start_timer()
print timeout()
Running this gives me:
Traceback (most recent call last):
File "prob.py", line 34, in <module>
print timeout()
TypeError: 'float' object is not callable
It doesn't look to me as if I'm trying to call currTime or timeout. What is going on here that I'm not understanding?