Feb-16-2020, 11:59 AM
(This post was last modified: Feb-16-2020, 11:59 AM by birdwatcher.)
Hey guys, birdwatcher here.
I am writing some code for a robot that I am building (the Robocon 2020 robot) and I am trying to set a timer so that after three minutes the robot switches off. However, whenever I run the code this error message pops up multiple times:
Exception in thread Thread-5:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 1166, in run
self.function(*self.args, **self.kwargs)
TypeError: 'int' object is not callable
Here is my code:
birdwatcher.
P.S.
The 'print("time")' code will be substituted for 'sys.exit()'.
I am writing some code for a robot that I am building (the Robocon 2020 robot) and I am trying to set a timer so that after three minutes the robot switches off. However, whenever I run the code this error message pops up multiple times:
Exception in thread Thread-5:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 1166, in run
self.function(*self.args, **self.kwargs)
TypeError: 'int' object is not callable
Here is my code:
from threading import Timer while True: t = Timer(3, 60) t.start() t.join() if t >= 180: print("Time")Thanks,
birdwatcher.
P.S.
The 'print("time")' code will be substituted for 'sys.exit()'.