That looks correct. There should be a log message that prints out when you actually connect to the robot. You need to enable logging to see it:
Code:
# To see messages from networktables, you must setup logging
import logging
logging.basicConfig(level=logging.DEBUG)
You probably want to add a sleep in that while loop.
I assume you've already looked through the
samples?