The first thing that I would recommend is using table viewer to ensure that the value is actually available. And, even if it's not available, the retrieveValue API doesn't have functionality to set a default value, so you should do one of two things:
- Set a default value when your program starts up
- Surround the retrieveValue() call with a try...except block
Finally, I tested the functionality, and you can use pynetworktables to retrieve a NumberArray.
However, the retrieveValue function returns None, not an array. Therefore, the code you have above won't work -- but remove the assignment, and it should be fine:
Code:
table = NetworkTable.getTable('/GRIP/myContoursReport')
na = NumberArray()
...
try:
table.retrieveValue('centerX', na)
except KeyError:
# do something else here...
else:
print(na)