[Git][NTPsec/ntpsec][master] ntpq: Fix for Python 2.
Gary E. Miller (@garyedmundsmiller)
gitlab at mg.gitlab.com
Mon Oct 13 22:22:50 UTC 2025
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
7884fdcc by Fred Wright at 2025-10-02T17:54:37-07:00
ntpq: Fix for Python 2.
As noted in the comment:
The BrokenPipeError doesn't exist in Python 2, but the problem that
requires catching it also doesn't seem to exist in Python 2, so just
make it a dummy in Python 2.
This just restores the old Python 2 behavior, without suppressing the
"Bailing out..." message.
TESTED:
Tested with Python 2.7 and 3.3-3.13.
- - - - -
1 changed file:
- ntpclients/ntpq.py
Changes:
=====================================
ntpclients/ntpq.py
=====================================
@@ -25,6 +25,14 @@ import socket
import sys
import time
+# The BrokenPipeError doesn't exist in Python 2, but the problem that requires
+# catching it also doesn't seem to exist in Python 2, so just make it a dummy
+# in Python 2.
+try:
+ BrokenPipeError
+except NameError:
+ BrokenPipeError = None
+
try:
import ntp.control
import ntp.ntpc
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/7884fdccb9e5d9c6aca31850200d08f497035429
--
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/7884fdccb9e5d9c6aca31850200d08f497035429
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20251013/6b352e43/attachment.htm>
More information about the vc
mailing list