seeing-things/track

NTP status check error

Opened this issue · 3 comments

Got the following error:

(venv) rgottula@nix:~/dev/track$ align
Traceback (most recent call last):
  File "/home/rgottula/dev/venv/bin/align", line 11, in <module>
    load_entry_point('track', 'console_scripts', 'align')()
  File "/home/rgottula/dev/track/track/align.py", line 230, in main
    ntp.check_ntp_status()
  File "/home/rgottula/dev/track/track/ntp.py", line 72, in check_ntp_status
    if int(gps_row.when.item()) > max_age:

Hmm. The snippet I put in the description seems to be missing the last few lines of the traceback. I will have to capture this again. I thought the exception had something to do with the pandas parser being tripped up by some dashes in some columns of the table printed by ntpq -p.

Here's another one that I got when the GPS receiver was not connected, but nix had internet access:

Traceback (most recent call last):
  File "/home/rgottula/dev/venv/bin/track", line 11, in <module>
    load_entry_point('track', 'console_scripts', 'track')()
  File "/home/rgottula/dev/track/track/__main__.py", line 84, in main
    ntp.check_ntp_status()
  File "/home/rgottula/dev/track/track/ntp.py", line 50, in check_ntp_status
    df = pd.read_csv(data, delim_whitespace=True, comment='=')
  File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 709, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 455, in _read
    data = parser.read(nrows)
  File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 1069, in read
    ret = self._engine.read(nrows)
  File "/usr/lib/python3/dist-packages/pandas/io/parsers.py", line 1839, in read
    data = self._reader.read(nrows)
  File "pandas/_libs/parsers.pyx", line 902, in pandas._libs.parsers.TextReader.read
  File "pandas/_libs/parsers.pyx", line 924, in pandas._libs.parsers.TextReader._read_low_memory
  File "pandas/_libs/parsers.pyx", line 978, in pandas._libs.parsers.TextReader._read_rows
  File "pandas/_libs/parsers.pyx", line 965, in pandas._libs.parsers.TextReader._tokenize_rows
  File "pandas/_libs/parsers.pyx", line 2208, in pandas._libs.parsers.raise_parser_error
pandas.errors.ParserError: Error tokenizing data. C error: Expected 10 fields in line 12, saw 11

And another example:

Traceback (most recent call last):
  File "/home/rgottula/dev/venv/bin/align", line 33, in <module>
    sys.exit(load_entry_point('track', 'console_scripts', 'align')())
  File "/home/rgottula/dev/track/track/align.py", line 286, in main
    ntp.check_ntp_status()
  File "/home/rgottula/dev/track/track/ntp.py", line 64, in check_ntp_status
    if 1e-3*gps_row.offset.item() > gps_max_offset:
  File "/home/rgottula/dev/venv/lib/python3.10/site-packages/pandas/core/base.py", line 347, in item
    raise ValueError("can only convert an array of size 1 to a Python scalar")
ValueError: can only convert an array of size 1 to a Python scalar