[Git][NTPsec/ntpsec][master] ntpviz: fix odd UTF-8 error in Python 2

Gary E. Miller gitlab at mg.gitlab.com
Fri Dec 1 03:55:29 UTC 2017


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


Commits:
f02d60ec by Gary E. Miller at 2017-11-30T19:54:18-08:00
ntpviz: fix odd UTF-8 error in Python 2

Not sure what broke this, something somewhat recent, and not on
all Python 2 hosts.

- - - - -


1 changed file:

- ntpclients/ntpviz.py


Changes:

=====================================
ntpclients/ntpviz.py
=====================================
--- a/ntpclients/ntpviz.py
+++ b/ntpclients/ntpviz.py
@@ -58,6 +58,11 @@ ntpviz: can't find the Python argparse module
 
 if sys.version_info[0] == 2:
     import codecs
+    import sys  
+
+    # force UTF-8 strings, otherwise some systems crash on micro.
+    reload(sys)  
+    sys.setdefaultencoding('utf8')
     def open(file, mode='r', buffering=-1, encoding=None, errors=None):
         return codecs.open(filename=file, mode=mode, encoding=encoding,
             errors=errors, buffering=buffering)



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f02d60ec59e7261625b457d44d60e64f3e604934

---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/f02d60ec59e7261625b457d44d60e64f3e604934
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/20171201/ebfca00b/attachment.html>


More information about the vc mailing list