See below for the crash that happened when the connection was interrupted. How can we most safely trigger a reconnect? close ctd object, reopen it, check status again? We don't need to parse many pieces in that case, I think.
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\Code\virtualenvs\server_virtualenv\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_line
utility.execute()
File "C:\Code\virtualenvs\server_virtualenv\lib\site-packages\django\core\management\__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Code\virtualenvs\server_virtualenv\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Code\virtualenvs\server_virtualenv\lib\site-packages\django\core\management\base.py", line 330, in execute
output = self.handle(*args, **options)
File "C:\Code\icefish_backend\icefish\management\commands\monitor_ctd.py", line 61, in handle
ctd.start_autosample(interval, realtime="Y", handler=handle_records, no_stop=True)
File "c:\code\seabird_ctd\seabird_ctd\__init__.py", line 439, in start_autosample
self.listen(interval)
File "c:\code\seabird_ctd\seabird_ctd\__init__.py", line 528, in listen
self.read_records()
File "c:\code\seabird_ctd\seabird_ctd\__init__.py", line 535, in read_records
data = self._read_all() # this will automatically check for data
File "c:\code\seabird_ctd\seabird_ctd\__init__.py", line 291, in _read_all
return self.send_command(command=None, length_to_read="ALL")
File "c:\code\seabird_ctd\seabird_ctd\__init__.py", line 276, in send_command
response = self._clean(data)
File "c:\code\seabird_ctd\seabird_ctd\__init__.py", line 294, in _clean
return response.decode("utf-8").split("\r\n") # first element of list should now be the command, but we'll let the caller filter that
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd0 in position 68: invalid continuation byte
DEBUG : Sending 'QS'
C:\Code\icefish_backend>%ICEFISH_INTERPRETER% manage.py monitor_ctd
Original comment by Nicholas Santos (Bitbucket: nickrsan, GitHub: nickrsan).
Should probably try to send a DS so we don't end up in a loop of unicode decode errors. If on a recovery, before going back into the loop, DS produces junk, we should probably just raise the exception.
Original report by Nicholas Santos (Bitbucket: nickrsan, GitHub: nickrsan).
See below for the crash that happened when the connection was interrupted. How can we most safely trigger a reconnect? close ctd object, reopen it, check status again? We don't need to parse many pieces in that case, I think.