Closed KhanSimeoni closed 4 years ago
Use getNumberArray
instead.
That returned the error
TypeError: 'int' object is not subscriptable
What's the full stack trace?
Is this what your looking for?
python3 test_network_receive.py 10.17.21.2
INFO:nt:NetworkTables initialized in client mode
DEBUG:nt.th:Started thread nt-dispatch-thread-0
DEBUG:nt.th:Started thread nt-client-thread-0
Traceback (most recent call last):
File "test_network_receive.py", line 23, in <module>
print("The center is at " + str((object1posX[3]-object1posX[1])+object1posX))
TypeError: 'int' object is not subscriptable
The default value that you passed to getNumberArray
is an integer, which is returned if the value isn't present in NetworkTables. Integers are not subscriptable, as the error message says.
Try getNumberArray('foo', [0,0,0,0])
instead. Or use None
as the default, and check to see if the value is None
and don't print if it is.
Got an NameError: name 'getNumberArray' is not defined
error
INFO:nt:NetworkTables initialized in client mode
DEBUG:nt.th:Started thread nt-dispatch-thread-0
DEBUG:nt.th:Started thread nt-client-thread-0
Traceback (most recent call last):
File "test_network_receive.py", line 22, in <module>
object1posX = getNumberArray('foo', [0,0,0,0])
NameError: name 'getNumberArray' is not defined
... table.getNumberArray
Hello, I have been trying to use getDoubleArray, but I keep getting an error. I am using it in the following code:
Unfortunatly, this returns the error:
Any idea what i'm doing wrong?