From 4509f3cc7a05f1614565323b522294a00cf3a751 Mon Sep 17 00:00:00 2001 From: "Gary E. Miller" <gem@rellim.com> Date: Sat, 10 Sep 2016 16:51:41 -0700 Subject: [PATCH] Revert "OPen all files with "b" flag. For Python 3 compatibility" This reverts commit 950d1fd9bb61f73e94c0b50572498d7fae96ac79. Well, that ended quickly and badly... --- ntpstats/ntpviz | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ntpstats/ntpviz b/ntpstats/ntpviz index 9ad3e18e83..8567d3b965 100755 --- 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() -- GitLab