Got printing serial data to web page working. The problem was when setInterval was calling the get_random() function, it was getting one instance of the dictionary so 'while len(dict): continue' was just waiting on an event that will never happen.