[Rivet-svn] rivet: Py3 fixes

Rivet Mercurial rivet at projects.hepforge.org
Wed Jan 17 14:45:02 GMT 2018


details:   https://rivet.hepforge.org/hg/rivet/rev/760d13212386
branches:  release-2-6-x
changeset: 6216:760d13212386
user:      David Grellscheid <david.grellscheid at durham.ac.uk>
date:      Wed Jan 17 14:37:52 2018 +0000
description:
Py3 fixes

diffs (truncated from 114 to 50 lines):

--- a/doc/mk-analysis-html	Thu Jan 11 13:01:25 2018 +0000
+++ b/doc/mk-analysis-html	Wed Jan 17 14:37:52 2018 +0000
@@ -14,7 +14,7 @@
 else:
     OUTFILE = args[0]+".html"
     OUTDIR = args[0]
-print "Using output file name '%s' and directory '%s'" % (OUTFILE, OUTDIR)
+print("Using output file name '%s' and directory '%s'" % (OUTFILE, OUTDIR))
 
 
 ## Add the rivet Python module build dir(s) to the Python module path, then import
@@ -28,7 +28,7 @@
 from glob import glob
 dirpatt = os.path.join(os.getcwd(), "..", "analyses", "plugin*")
 for d in glob(dirpatt):
-    #print d
+    #print(d)
     rivet.addAnalysisDataPath(os.path.abspath(d))
 
 
@@ -72,13 +72,13 @@
 try:
     os.makedirs(OUTDIR)
 except:
-    print "Error: failed to make new directory '%s'" % OUTDIR
+    print("Error: failed to make new directory '%s'" % OUTDIR)
     sys.exit(1)
 
 ## Find analysis source files
 ccpatt = os.path.join(os.getcwd(), "..", "analyses", "plugin*", "*.cc")
 ccfiles = glob(ccpatt)
-#print ccfiles
+#print(ccfiles)
 
 summaries = {}
 pages = []
@@ -201,9 +201,9 @@
                 page += "<kbd>" + src.replace("\n", "<br/>\n") + "</kbd>"
 
     # Write out HTML analysis file
-    #print aname
+    #print(aname)
     ANAFILE = os.path.join(OUTDIR, aname+'.html')
-    f = open(ANAFILE, "w")
+    f = open(ANAFILE, "wb")
     outstr = unicode(head + page + foot)
     f.write(outstr.encode(errors="ignore"))
     f.close()
@@ -220,7 +220,7 @@
 outstr = head + toc + foot


More information about the Rivet-svn mailing list