Python ntpq

Achim Gratz Stromeko at nexgo.de
Sat Nov 26 13:00:03 UTC 2016


I've configured to use python3.4m, since that's what I have a matching
python-config installed for.  However, all the Python scripts still use
/usr/bin/python (which points to python2.7 on my system) and hilarity
ensues.  The waf build or install needs to create the correct shebang
lines when a different python binary is configured, I suppose.

Why PYTHONPATH is necessary isn't really clear to me (but then I know
next to nothing about Python).  The parent directory is in sys.path, so
it should know how to find the ntp dir without any configuration, as it
does with the other packages that are already there.  Or again waf
should add the correct PYTHONPATH to the shebang line.

Editing the shebang by hand then doesn't work anyway:

traceback (most recent call last):
  File "/usr/bin/ntpq", line 1590, in <module>
    interpreter.onecmd(cmd)
  File "/usr/lib/python3.4/cmd.py", line 217, in onecmd
    return func(arg)
  File "/usr/bin/ntpq", line 956, in do_rv
    self.do_readvar(line)
  File "/usr/bin/ntpq", line 946, in do_readvar
    self.__dolist(line.split()[1:], associd, ntp.packet.CTL_OP_READVAR, qtype, quiet=True)
  File "/usr/bin/ntpq", line 456, in __dolist
    variables = self.session.readvar(associd, varlist, op)
  File "/usr/lib/python3/dist-packages/ntp/packet.py", line 1104, in readvar
    self.doquery(opcode, associd=associd, qdata=qdata)
  File "/usr/lib/python3/dist-packages/ntp/packet.py", line 1040, in doquery
    res = self.getresponse(opcode, associd, not retry)
  File "/usr/lib/python3/dist-packages/ntp/packet.py", line 904, in getresponse
    rpkt.analyze(rawdata)
  File "/usr/lib/python3/dist-packages/ntp/packet.py", line 526, in analyze
    rawdata[:ControlPacket.HEADER_LEN])
TypeError: 'str' does not support the buffer interface

So I've installed python-dev to get pathon-conf for 2.7 and ntpq finally
works.  The shortest unique abbreviation for commands isn't working
anymore (Hal already notedt that).  Also, while it's good that the print
can use a wide terminal now, it really shouldn't move the data to the
right as far as possible (my text console is 320 characters wide and the
usual graphics terminal 176 characters).  Can the fields please be
widened only so much that they show the data without truncation?  Else
I'd need some option to limit the width of the printout.

The output from the cv command mangles the timecode string from the GPS:

timecode=""$GPZDA", 120543.000="", 26="", 11="", 2016="", 00="", 00*56"="",

This used to look like that (and really still should):

timecode="$GPZDA,120543.000,26,11,2016,00,00*56",


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf rackAttack:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds



More information about the devel mailing list