Blob Blame History Raw
diff --git a/doc/include_anchors.py b/doc/include_anchors.py
--- a/doc/include_anchors.py
+++ b/doc/include_anchors.py
@@ -13,12 +13,12 @@
 import os
 
 
-pat1a = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.py\[\]')
-pat1b = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.sh\[\]')
-pat1c = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.h\[\]')
-pat1d = re.compile('include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.cpp\[\]')
-pat2 = re.compile('([^@]+)@([a-zA-Z0-9]+):')
-pat3 = re.compile('([^@]+)@:([a-zA-Z0-9]+)')
+pat1a = re.compile(r'include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.py\[\]')
+pat1b = re.compile(r'include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.sh\[\]')
+pat1c = re.compile(r'include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.h\[\]')
+pat1d = re.compile(r'include::([a-zA-Z0-9_\.\-/\/]+\/)\.([^\_]+)\_[a-zA-Z0-9]*\.cpp\[\]')
+pat2 = re.compile(r'([^@]+)@([a-zA-Z0-9]+):')
+pat3 = re.compile(r'([^@]+)@:([a-zA-Z0-9]+)')
 
 processed = set()
 
@@ -44,18 +44,18 @@
             del anchors[anchor]
         else:
             for anchor in anchors:
-                os.write(anchors[anchor].fileno(), line)
+                os.write(anchors[anchor].fileno(), bytearray(line, 'utf-8'))
     INPUT.close()
     for anchor in anchors:
         if anchor != '':
-            print "ERROR: anchor '%s' did not terminate" % anchor
+            print("ERROR: anchor '%s' did not terminate" % anchor)
         anchors[anchor].close()
     #
     processed.add(bname)
 
 
 for file in sys.argv[1:]:
-    print "Processing file '%s' ..." % file
+    print("Processing file '%s' ..." % file)
     INPUT = open(file, 'r')
     for line in INPUT:
         suffix = None
@@ -82,8 +82,8 @@
             #print "HERE", line, suffix
             fname = m.group(1)+m.group(2)+'.'+suffix
             if not os.path.exists(fname):
-                print line
-                print "ERROR: file '%s' does not exist!" % fname
+                print(line)
+                print("ERROR: file '%s' does not exist!" % fname)
                 sys.exit(1)
             process(m.group(1), m.group(2), suffix)
     INPUT.close()