[Git][NTPsec/ntpsec][master] Revert "OPen all files with "b" flag. For Python 3 compatibility"

Gary E. Miller gitlab at mg.gitlab.com
Sat Sep 10 23:52:23 UTC 2016


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


Commits:
4509f3cc by Gary E. Miller at 2016-09-10T16:51:41-07:00
Revert "OPen all files with "b" flag.  For Python 3 compatibility"

This reverts commit 950d1fd9bb61f73e94c0b50572498d7fae96ac79.

Well, that ended quickly and badly...

- - - - -


1 changed file:

- ntpstats/ntpviz


Changes:

=====================================
ntpstats/ntpviz
=====================================
--- a/ntpstats/ntpviz
+++ b/ntpstats/ntpviz
@@ -66,7 +66,7 @@ def gnuplot(template, outfile=None):
     if outfile is None:
         out = None
     else:
-        out = open(outfile, "wb")
+        out = open(outfile, "w")
     # shell=True is a security hazard
     proc = subprocess.Popen("gnuplot",
                             shell=False, bufsize=4096,
@@ -783,13 +783,13 @@ if __name__ == '__main__':
     # if no ntpsec favicon.ico, write one.
     ico_filename = os.path.join(outdir, "favicon.ico")
     if not os.path.lexists( ico_filename ):
-        with open( ico_filename, "wb" ) as wp:
+        with open( ico_filename, "w" ) as wp:
             wp.write(binascii.a2b_base64(ntpsec_ico))
 
     # if no ntpsec logo, write one.
     logo_filename = os.path.join(outdir, "ntpsec-logo.png")
     if not os.path.lexists( logo_filename ):
-        with open( logo_filename, "wb" ) as wp:
+        with open( logo_filename, "w" ) as wp:
             wp.write(binascii.a2b_base64(ntpsec_logo))
 
     explanations = {
@@ -882,7 +882,7 @@ at 0s. Typical 90% ranges may be: local serial GPS 200 ms; local LAN peer
     title = 'ntpviz'
     if os.path.isfile(title_f):
         try:
-            title_file = open( title_f, 'rb')
+            title_file = open( title_f, 'r')
             title = title_file.read()
         except IOError:
             pass
@@ -1012,7 +1012,7 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
     header = os.path.join(outdir, "header")
     if os.path.isfile(header):
         try:
-            header_file = open( header, 'rb')
+            header_file = open( header, 'r')
             header_txt = header_file.read()
             index_buffer += '<br>\n' + header_txt + '\n'
         except IOError:
@@ -1066,7 +1066,7 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
     footer = os.path.join(outdir, "footer")
     if os.path.isfile(footer):
         try:
-            footer_file = open( footer, 'rb')
+            footer_file = open( footer, 'r')
             footer_txt = footer_file.read()
             index_buffer += '<br>\n' + footer_txt + '\n'
         except IOError:
@@ -1074,7 +1074,7 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
     index_buffer += index_trailer
 
     # and send the file buffer
-    with open(os.path.join(outdir, "index.html"), "wb") as ifile:
+    with open(os.path.join(outdir, "index.html"), "w") as ifile:
         ifile.write(index_buffer)
         ifile.close()
 



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/4509f3cc7a05f1614565323b522294a00cf3a751
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ntpsec.org/pipermail/vc/attachments/20160910/10a5ccfe/attachment.html>


More information about the vc mailing list