[Git][NTPsec/ntpsec][master] ntpviz: partial fix for issue #16

Gary E. Miller gitlab at mg.gitlab.com
Wed Jan 4 02:36:55 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
9fb75dcc by Gary E. Miller at 2017-01-03T18:34:57-08:00
ntpviz: partial fix for issue #16

Note in INSTALL file that Python 2.6 requires: pip install argparse
Add error message for missing argparse to alert the user to
install it manually: pip install argparse

- - - - -


2 changed files:

- INSTALL
- ntpclients/ntpviz


Changes:

=====================================
INSTALL
=====================================
--- a/INSTALL
+++ b/INSTALL
@@ -51,6 +51,10 @@ gnuplot::
    Ubuntu package: gnuplot5
    SLES: gnuplot
 
+argarse::
+   Required for ntpviz when with Python version 2.6
+   Install with pip: pip install argparse
+
 psutils::
    Optional for ntpviz.  Allows running with ionice()
    Debian package: python-psutil or python3-psutil


=====================================
ntpclients/ntpviz
=====================================
--- a/ntpclients/ntpviz
+++ b/ntpclients/ntpviz
@@ -33,7 +33,6 @@ Python by ESR, concept and gnuplot code by Dan Drown.
 # SPDX-License-Identifier: BSD-2-Clause
 from __future__ import print_function, division
 
-import argparse
 import csv
 import datetime
 import re
@@ -45,6 +44,16 @@ import socket
 import sys
 import subprocess
 import tempfile
+try:
+    import argparse
+except ImportError as e:
+    sys.stderr.write("""
+ntpviz: can't find Python argparse module
+        If your Python < 2.7, then manual installation is needed:
+        # pip install argparse
+%s
+""")
+    sys.exit(1)
 
 
 # Gack, python before 3.2 has no defined tzinfo for utc...
@@ -65,7 +74,7 @@ try:
     import ntp.statfiles
     import ntp.util
 except ImportError as e:
-    sys.stderr.write("ntpviz: can't find Python NTP library "
+    sys.stderr.write("ntpviz: can't find Python NTP modules "
                      "-- check PYTHONPATH.\n")
     sys.stderr.write("%s\n" % e)
     sys.exit(1)



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/9fb75dcc388667294c7919dfed83d57da95ec75a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170104/d41b1b96/attachment.html>


More information about the vc mailing list