Problems with PyNetworkTables

It’s day one at our event and our PyNetworkTables have randomly stopped working. Nothing we’ve done has fixed it. Any help would be appreciated. We’ve tried reassigning IPs, checking the Python code, everything. It only stopped working once we attempted it on the main field, it worked at the practice field. Once at the main field it didn’t work after.

DEBUG:nt:client connected
DEBUG:nt:NetworkConnection stopping (<ntcore.network_connection.NetworkConnection object at 0x712411b0>)
ERROR:nt:Unhandled exception during handshake
Traceback (most recent call last):
  File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/ntcore/network_connection.py", line 240, in _readThreadMain
    handshake_success = self.m_handshake(self, _getMessage, self._sendMessages)
  File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/ntcore/dispatcher.py", line 488, in _clientHandshake
    msg = get_msg()
  File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/ntcore/network_connection.py", line 228, in _getMessage
    return Message.read(self.m_stream, decoder, self.m_get_entry_type)
  File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/ntcore/message.py", line 123, in read
    value = codec.read_value(value_type, rstream)
  File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/ntcore/wire.py", line 126, in read_value
    return Value.makeStringArray([self.read_string(rstream) for _ in range(alen)])
  File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/ntcore/wire.py", line 126, in <listcomp>
    return Value.makeStringArray([self.read_string(rstream) for _ in range(alen)])
  File "/home/pi/.virtualenvs/cv/lib/python3.4/site-packages/ntcore/wire.py", line 198, in read_string_v3
    return rstream.read(slen).decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf0 in position 47: invalid continuation byte
INFO:nt:DISCONNECTED 10.0.66.2 port 1735 (Robot)
DEBUG:nt:write thread died (<ntcore.network_connection.NetworkConnection object at 0x70088430>)

Others have reported this, but I haven’t been able to reproduce it at all here. If you can help me do that, I can fix it.

Issue is at https://github.com/robotpy/pynetworktables/issues/42

I’ve pushed pynetworktables 2017.0.7a1 with a potential hack to fix this – just tells python to ignore the bad unicode characters. I’m not convinced this is the right way to address the issue however.

We had the same issue today. We were working in our build space when pynetworktables stopped working with the same error as above (we’re running vision code on a pi and sending the results to the roborio through network tables). We hadn’t modified the code when it stopped working. The error went away when we updated to 2017.0.7a1, but we could not write into or read from the network tables.

Hm, that’s very strange.

If you have a way to reproduce this, please comment on UnicodeDecodeError trying to connect to Network Tables on roboRIO (Java) from raspberry pi with Microsoft Lifecam · Issue #42 · robotpy/pynetworktables · GitHub so we can get this fixed. Thanks!