73cd69
From b2c5de7835a753cad1f35db8202c4733b5fc2990 Mon Sep 17 00:00:00 2001
73cd69
From: Parag A Nemade <pnemade@fedoraproject.org>
73cd69
Date: Mon, 3 Oct 2016 12:56:29 +0530
8a7942
Subject: [PATCH] Add python3 support
8a7942
73cd69
Signed-off-by: Parag A Nemade <pnemade@fedoraproject.org>
8a7942
---
8a7942
 pycontrib/FontCompare/fc/BitmapHandler.py    | 20 +++++++--------
8a7942
 pycontrib/FontCompare/fc/DocCompare.py       |  2 +-
8a7942
 pycontrib/FontCompare/fc/FontCompare.py      |  2 +-
8a7942
 pycontrib/FontCompare/fc/GlyphConsistency.py |  2 +-
8a7942
 pycontrib/FontCompare/fontcompare            |  2 +-
8a7942
 pycontrib/FontCompare/unittests/unittests.py | 18 ++++++-------
8a7942
 pycontrib/collab/web-test-collab.py          |  2 +-
8a7942
 pycontrib/even.py                            |  2 +-
73cd69
 pycontrib/gdraw/__init__.py                  |  4 +--
73cd69
 pycontrib/gdraw/gdraw.py                     | 20 +++++++--------
73cd69
 pycontrib/graphicore.py                      |  4 +--
8a7942
 pycontrib/graphicore/ipython_view.py         | 13 +++++-----
73cd69
 pycontrib/graphicore/shell.py                |  4 +--
8a7942
 pycontrib/svg2sfd.py                         | 38 ++++++++++++++--------------
73cd69
 pycontrib/webcollab.py                       |  6 ++---
73cd69
 15 files changed, 70 insertions(+), 69 deletions(-)
8a7942
8a7942
diff --git a/pycontrib/FontCompare/fc/BitmapHandler.py b/pycontrib/FontCompare/fc/BitmapHandler.py
8a7942
index d4d00da..c159128 100644
8a7942
--- a/pycontrib/FontCompare/fc/BitmapHandler.py
8a7942
+++ b/pycontrib/FontCompare/fc/BitmapHandler.py
8a7942
@@ -35,7 +35,7 @@ def white_bg_square(img):
8a7942
     "return a white-background-color image having the img in exact center"
8a7942
     size = (max(img.size),)*2
8a7942
     layer = Image.new('1', size, 1)
8a7942
-    layer.paste(img, tuple(map(lambda x:(x[0]-x[1])/2, zip(size, img.size))))
8a7942
+    layer.paste(img, tuple([(x[0]-x[1])/2 for x in zip(size, img.size)]))
8a7942
     return layer
8a7942
 
8a7942
 class BitmapCompare:
8a7942
@@ -73,13 +73,13 @@ class CreateSpriteSheet:
8a7942
         #seperate each image with lots of whitespace
8a7942
         master_height = pixelsize
8a7942
         oldfont = font
8a7942
-        print "the master image will by %d by %d" % (master_width, master_height)
8a7942
-        print "creating image..."
8a7942
+        print("the master image will by %d by %d" % (master_width, master_height))
8a7942
+        print("creating image...")
8a7942
         master = Image.new(
8a7942
         mode='1',
8a7942
         size=(master_width, master_height),
8a7942
         color=0) # fully transparent
8a7942
-        print "created."
8a7942
+        print("created.")
8a7942
         if effects == "italic":
8a7942
             font.selection.all()
8a7942
             font = font.italicize(-13)
8a7942
@@ -92,16 +92,16 @@ class CreateSpriteSheet:
8a7942
                     font[i].changeWeight(50,"auto",0,0,"auto")
8a7942
                 font[i].export("temp.bmp",pixelsize,1)
8a7942
                 img = Image.open("temp.bmp")
8a7942
-                print "adding %s at %d..." % (str(i)+".bmp", location),
8a7942
+                print("adding %s at %d..." % (str(i)+".bmp", location), end=' ')
8a7942
                 square_one = white_bg_square(img)
8a7942
                 square_one.resize((pixelsize, pixelsize))
8a7942
                 master.paste(square_one,(location,0))
8a7942
-                print "added."
8a7942
+                print("added.")
8a7942
             except:
8a7942
-                print "ooopsy"
8a7942
+                print("ooopsy")
8a7942
             count+=1
8a7942
-        print "done adding pics."
8a7942
-        print "saving mastersprite.bmp..."
8a7942
+        print("done adding pics.")
8a7942
+        print("saving mastersprite.bmp...")
8a7942
         master.save('data/mastersprite'+effects+'.bmp' )
8a7942
-        print "saved!"
8a7942
+        print("saved!")
8a7942
         font.close()
8a7942
diff --git a/pycontrib/FontCompare/fc/DocCompare.py b/pycontrib/FontCompare/fc/DocCompare.py
8a7942
index 3a54bf9..df431e2 100644
8a7942
--- a/pycontrib/FontCompare/fc/DocCompare.py
8a7942
+++ b/pycontrib/FontCompare/fc/DocCompare.py
8a7942
@@ -41,7 +41,7 @@ class DocCompare:
8a7942
         bashcommand = "hb-view --output-format=\"png\" --output-file=\"/var/tmp/test.png\" --font-size="+str(fontsize)+" --text-file=\""
8a7942
         bashcommand+=docpath+"\" "+"\""+testpath+"\""
8a7942
         os.system(str(bashcommand))
8a7942
-        print bashcommand
8a7942
+        print(bashcommand)
8a7942
         thefile = pkg_resources.resource_filename("fc",mockfont.highresdocfile)
8a7942
         shutil.copy(thefile,"/var/tmp/standard.png")
8a7942
         cm = BitmapCompare()
8a7942
diff --git a/pycontrib/FontCompare/fc/FontCompare.py b/pycontrib/FontCompare/fc/FontCompare.py
8a7942
index f21718c..c82b788 100644
8a7942
--- a/pycontrib/FontCompare/fc/FontCompare.py
8a7942
+++ b/pycontrib/FontCompare/fc/FontCompare.py
8a7942
@@ -111,7 +111,7 @@ class FontCompare(object):
8a7942
         scores = list()
8a7942
         comparator = BitmapCompare()
8a7942
         pixelsize = (resolution*ptsize)/72
8a7942
-        print spritepath
8a7942
+        print(spritepath)
8a7942
         for i in range (glyphRange[0],glyphRange[1]):
8a7942
             if i in Testfont:
8a7942
                 Testfont[i].export("/var/tmp/tmp.bmp",pixelsize,1)
8a7942
diff --git a/pycontrib/FontCompare/fc/GlyphConsistency.py b/pycontrib/FontCompare/fc/GlyphConsistency.py
8a7942
index 38273c9..d5265fa 100644
8a7942
--- a/pycontrib/FontCompare/fc/GlyphConsistency.py
8a7942
+++ b/pycontrib/FontCompare/fc/GlyphConsistency.py
8a7942
@@ -102,7 +102,7 @@ class GlyphConsistency:
8a7942
         for i in range (glyphrange[0],glyphrange[1]):
8a7942
             if i in font:
8a7942
                 score =  self.glyph_round_compare(font[i],pixelsize)
8a7942
-                print score
8a7942
+                print(score)
8a7942
                 set_round_score+=score
8a7942
                 total+=1
8a7942
         font.close()
8a7942
diff --git a/pycontrib/FontCompare/fontcompare b/pycontrib/FontCompare/fontcompare
8a7942
index e7e68d8..fdf7336 100755
8a7942
--- a/pycontrib/FontCompare/fontcompare
8a7942
+++ b/pycontrib/FontCompare/fontcompare
8a7942
@@ -15,7 +15,7 @@
8a7942
     along with this program.  If not, see <http: www.gnu.org="" licenses=""/>.
8a7942
 """
8a7942
 
8a7942
-#! /usr/bin/python
8a7942
+#! /usr/bin/python3
8a7942
 from PyQt4.QtGui import QMessageBox
8a7942
 from PyQt4.QtGui import QMainWindow
8a7942
 from PyQt4.QtGui import QApplication
8a7942
diff --git a/pycontrib/FontCompare/unittests/unittests.py b/pycontrib/FontCompare/unittests/unittests.py
8a7942
index 18e1e95..d8a1190 100644
8a7942
--- a/pycontrib/FontCompare/unittests/unittests.py
8a7942
+++ b/pycontrib/FontCompare/unittests/unittests.py
8a7942
@@ -55,7 +55,7 @@ class Basictests(unittest.TestCase):
8a7942
         for tup in basic:
8a7942
             if tup[1]!=10:
8a7942
                 bastest=0
8a7942
-        self.failUnless(bastest)
8a7942
+        self.assertTrue(bastest)
8a7942
         testfont = fontforge.open("unittests/lohit.ttf")
8a7942
         bold = cm.font_facecompare(testfont,mockfont,(0x900,0x97f),\
8a7942
         600,12,1,"bold")
8a7942
@@ -66,28 +66,28 @@ class Basictests(unittest.TestCase):
8a7942
         normal = cm.font_facecompare(testfont,mockfont,(0x900,0x97f),\
8a7942
         600,12,1,"normal")
8a7942
         test = 1
8a7942
-        print len(normal)
8a7942
+        print(len(normal))
8a7942
         for tup in bold:
8a7942
             if tup[1]==100 or tup[1]==0:
8a7942
                 test1=1
8a7942
                 break
8a7942
-        self.failUnless(test)
8a7942
+        self.assertTrue(test)
8a7942
         test = 0
8a7942
         for tup in italic:
8a7942
             if tup[1]==100 or tup[1]==0:
8a7942
                 test=1
8a7942
                 break
8a7942
-        self.failUnless(test is 1)
8a7942
+        self.assertTrue(test is 1)
8a7942
         test = 0
8a7942
         for tup in normal:
8a7942
             if tup[1]==100 or tup[1]==0:
8a7942
                 test=1
8a7942
                 break
8a7942
-        self.failUnless(test is 1)
8a7942
+        self.assertTrue(test is 1)
8a7942
         test = 0
8a7942
         if len(normal) == len(bold) == len(italic):
8a7942
             test = 1
8a7942
-        self.failUnless(test is 1)
8a7942
+        self.assertTrue(test is 1)
8a7942
 
8a7942
     def testGlyphConsistency(self):
8a7942
         cm = GlyphConsistency()
8a7942
@@ -99,11 +99,11 @@ class Basictests(unittest.TestCase):
8a7942
         test3 = cm.glyph_round_consistency(testfont,(0x900,0x97f),50)
8a7942
 
8a7942
         test = (0 <= test1[0][1] <= 10)
8a7942
-        self.failUnless(test)
8a7942
+        self.assertTrue(test)
8a7942
         test2 = (0 <= test2 <= 10)
8a7942
-        self.failUnless(test2)
8a7942
+        self.assertTrue(test2)
8a7942
         test3 = (0 <= test3 <= 10)
8a7942
-        self.failUnless(test3)
8a7942
+        self.assertTrue(test3)
8a7942
 
8a7942
 """
8a7942
 unittests for DocCompare not required.
8a7942
diff --git a/pycontrib/collab/web-test-collab.py b/pycontrib/collab/web-test-collab.py
8a7942
index 47b763f..b19f930 100755
8a7942
--- a/pycontrib/collab/web-test-collab.py
8a7942
+++ b/pycontrib/collab/web-test-collab.py
8a7942
@@ -68,7 +68,7 @@ def OnCollabUpdate(f):
8a7942
             "end": "null" # this is simply so we dont have to manage keeping the last item with no terminating ,
8a7942
             }, 
8a7942
             sort_keys=True, indent=4, separators=(',', ': '))
8a7942
-    print js
8a7942
+    print(js)
8a7942
     fi = open(fontJsonOnDisk, 'w')
8a7942
     fi.write(js)
8a7942
 
8a7942
diff --git a/pycontrib/even.py b/pycontrib/even.py
8a7942
index 96f9128..4f30fcb 100755
8a7942
--- a/pycontrib/even.py
8a7942
+++ b/pycontrib/even.py
8a7942
@@ -1,4 +1,4 @@
8a7942
-#!/usr/bin/python
8a7942
+#!/usr/bin/python3
8a7942
 # -*- coding: utf-8 -*-
8a7942
 """
8a7942
 running even from the fontforge menu
8a7942
diff --git a/pycontrib/gdraw/__init__.py b/pycontrib/gdraw/__init__.py
73cd69
index d47976c..dde7ea8 100644
8a7942
--- a/pycontrib/gdraw/__init__.py
8a7942
+++ b/pycontrib/gdraw/__init__.py
8a7942
@@ -1,4 +1,4 @@
8a7942
-#!/usr/bin/python
8a7942
+#!/usr/bin/python3
8a7942
 # vim:ts=8:sw=4:expandtab:encoding=utf-8
8a7942
 '''
8a7942
 Copyright <hashao2@gmail.com> 2009
73cd69
@@ -22,7 +22,7 @@ Copyright <hashao2@gmail.com> 2009
73cd69
 __all__ = ['Timer', 'GtkRunner', 'gtkrunner']
73cd69
 __version__ = '0.1'
73cd69
 
73cd69
-from gdraw import *
73cd69
+from .gdraw import *
73cd69
 
73cd69
 def main():
73cd69
     pass
8a7942
diff --git a/pycontrib/gdraw/gdraw.py b/pycontrib/gdraw/gdraw.py
73cd69
index f2d5e50..8b6e693 100755
8a7942
--- a/pycontrib/gdraw/gdraw.py
8a7942
+++ b/pycontrib/gdraw/gdraw.py
8a7942
@@ -1,4 +1,4 @@
8a7942
-#!/usr/bin/python
8a7942
+#!/usr/bin/python3
8a7942
 '''ctypes wrapper to Attach the GDraw event handler to the gtk main loop.
8a7942
 
8a7942
 Copyright <hashao2@gmail.com> 2009
73cd69
@@ -67,7 +67,7 @@ def setup_syspath(modpath="modules"):
73cd69
 
73cd69
 __all__ = ['Timer', 'GtkRunner', 'gtkrunner']
73cd69
 
73cd69
-from _gdraw import *
73cd69
+from ._gdraw import *
73cd69
 from ctypes import *
73cd69
 import types
73cd69
 
8a7942
@@ -111,7 +111,7 @@ class Timer:
8a7942
 
8a7942
         return
8a7942
         def dodo(*args):
8a7942
-            print 'aaa'
8a7942
+            print('aaa')
8a7942
             return False
8a7942
         self.add(1000, dodo)
8a7942
 
8a7942
@@ -122,7 +122,7 @@ class Timer:
8a7942
 
8a7942
     def _event_handler(self, gw, event):
8a7942
         evt = event.contents
8a7942
-        print "_event_handler()"
8a7942
+        print("_event_handler()")
8a7942
         if evt.type == et_timer:
8a7942
             timer = evt.u.timer.timer
8a7942
             tkey = addressof(timer.contents)
8a7942
@@ -147,7 +147,7 @@ class Timer:
8a7942
         ci.func = CallBackFunc(func)
8a7942
         ci.data = data
8a7942
 
8a7942
-        print "timer.add timeout", timeout
8a7942
+        print("timer.add timeout", timeout)
8a7942
         frequency = 1 # Use return value of func() to decide repeat like gtk.
8a7942
         timer = GDrawRequestTimer(self.win, timeout, timeout, byref(ci))
8a7942
 
8a7942
@@ -190,7 +190,7 @@ class GtkRunner:
8a7942
 
8a7942
     def _do_main(self, *args):
8a7942
         '''The function called by the gdraw timeout handler.'''
8a7942
-        print "do_main"
8a7942
+        print("do_main")
8a7942
         while gtk.events_pending():
8a7942
             gtk.main_iteration(False)
8a7942
         return True
8a7942
@@ -207,15 +207,15 @@ class GtkRunner:
8a7942
             self.gtk_timer = None
8a7942
 
8a7942
     def OnDestroyWindow(self, widget, fd ):
8a7942
-        print fd
8a7942
+        print(fd)
8a7942
         fontforge.removeGtkWindowToMainEventLoopByFD( fd )
8a7942
         self.stop()
8a7942
         return True
8a7942
 
8a7942
     def sniffwindow(self,w):
8a7942
         '''sniff key presses for a gtk window'''
8a7942
-        print "sniffwindow w", w
8a7942
-        print "sniff active font:", fontforge.activeFont()
8a7942
+        print("sniffwindow w", w)
8a7942
+        print("sniff active font:", fontforge.activeFont())
8a7942
         w.connect("key-release-event", self._do_main)
8a7942
         fontforge.addGtkWindowToMainEventLoop(w.window.xid)
8a7942
         fd = fontforge.getGtkWindowMainEventLoopFD(w.window.xid)
8a7942
@@ -223,7 +223,7 @@ class GtkRunner:
8a7942
 
8a7942
     def sniffwindowid(self,xid):
8a7942
         '''sniff key presses for a gtk window'''
8a7942
-        print "sniffwindowid xid", xid
8a7942
+        print("sniffwindowid xid", xid)
8a7942
         #w.connect("key-release-event", self._do_main)
8a7942
 
8a7942
     def start(self, timeout=GTIMEOUT):
8a7942
diff --git a/pycontrib/graphicore.py b/pycontrib/graphicore.py
73cd69
index f95e488..229a2b7 100755
8a7942
--- a/pycontrib/graphicore.py
8a7942
+++ b/pycontrib/graphicore.py
8a7942
@@ -1,4 +1,4 @@
8a7942
-#!/usr/bin/python
8a7942
+#!/usr/bin/python3
8a7942
 # -*- coding: utf-8 -*-
8a7942
 """
8a7942
 running the fontforge scripts in the graphicore folder on fontforge startup
73cd69
@@ -22,4 +22,4 @@ sys.path.append(os.path.dirname(sys.modules[__name__].__file__))
73cd69
 sys.path.reverse();
73cd69
 
73cd69
 #load the modules
73cd69
-import graphicore.shell
73cd69
\ No newline at end of file
73cd69
+import graphicore.shell
8a7942
diff --git a/pycontrib/graphicore/ipython_view.py b/pycontrib/graphicore/ipython_view.py
8a7942
index f39eedb..2b77395 100644
8a7942
--- a/pycontrib/graphicore/ipython_view.py
8a7942
+++ b/pycontrib/graphicore/ipython_view.py
8a7942
@@ -1,4 +1,4 @@
8a7942
-#!/usr/bin/python
8a7942
+#!/usr/bin/python3
8a7942
 '''
8a7942
 Provides IPython console widget.
8a7942
 
8a7942
@@ -17,10 +17,11 @@ import re
8a7942
 import sys
8a7942
 import os
8a7942
 import pango
8a7942
-from StringIO import StringIO
8a7942
-import thread
8a7942
+from io import StringIO
8a7942
+import _thread
8a7942
 
8a7942
 import IPython
8a7942
+from functools import reduce
8a7942
 
8a7942
 class IterableIPShell:
8a7942
   '''
8a7942
@@ -118,7 +119,7 @@ class IterableIPShell:
8a7942
     '''
8a7942
     This function updates namespace with sys.modules
8a7942
     '''
8a7942
-    for k,v in sys.modules.items():
8a7942
+    for k,v in list(sys.modules.items()):
8a7942
       if not '.' in k:
8a7942
         self.IP.user_ns.update({k:v})
8a7942
 
8a7942
@@ -271,11 +272,11 @@ class IterableIPShell:
8a7942
     @type header: string
8a7942
     '''
8a7942
     stat = 0
8a7942
-    if verbose or debug: print header+cmd
8a7942
+    if verbose or debug: print(header+cmd)
8a7942
     # flush stdout so we don't mangle python's buffering
8a7942
     if not debug:
8a7942
       input, output = os.popen4(cmd)
8a7942
-      print output.read()
8a7942
+      print(output.read())
8a7942
       output.close()
8a7942
       input.close()
8a7942
 
8a7942
diff --git a/pycontrib/graphicore/shell.py b/pycontrib/graphicore/shell.py
73cd69
index 5d102f7..32fa584 100755
8a7942
--- a/pycontrib/graphicore/shell.py
8a7942
+++ b/pycontrib/graphicore/shell.py
8a7942
@@ -1,4 +1,4 @@
8a7942
-#!/usr/bin/python
8a7942
+#!/usr/bin/python3
8a7942
 # -*- coding: utf-8 -*-
8a7942
 """
8a7942
 FontForge Interactive Python Shell
73cd69
@@ -32,7 +32,7 @@ if len(sys.argv) == 0:
73cd69
     # some versions of IPython need content in sys.argv
73cd69
     sys.argv.append('')
73cd69
 
73cd69
-from ipython_view import *
73cd69
+from .ipython_view import *
73cd69
 import gdraw
73cd69
 
73cd69
 def runShell(data = None, glyphOrFont = None):
8a7942
diff --git a/pycontrib/svg2sfd.py b/pycontrib/svg2sfd.py
8a7942
index e1fc0ac..e23cb15 100644
8a7942
--- a/pycontrib/svg2sfd.py
8a7942
+++ b/pycontrib/svg2sfd.py
8a7942
@@ -1,4 +1,4 @@
8a7942
-#!/usr/bin/python
8a7942
+#!/usr/bin/python3
8a7942
 #
8a7942
 # Copyright 2013 Google Inc. All rights reserved.
8a7942
 # 
8a7942
@@ -49,7 +49,7 @@ def print_one_cmd(cmd, args):
8a7942
       result.append('%f' % (scale * args[i]))
8a7942
   result.append(cmd)
8a7942
   result.append('0')  # TODO: should mark corner points
8a7942
-  print ' '.join(result)
8a7942
+  print(' '.join(result))
8a7942
 
8a7942
 def apply_rel_xy(xy, args):
8a7942
   x0, y0 = xy
8a7942
@@ -75,7 +75,7 @@ def path_to_sfd(path):
8a7942
     for i in range(num_args_cmd(cmd)):
8a7942
       m = fre.match(path)
8a7942
       if m is None:
8a7942
-        print 'no float match:', path
8a7942
+        print('no float match:', path)
8a7942
       args.append(float(m.group(1)))
8a7942
       path = path[m.end():]
8a7942
     #print cmd, args
8a7942
@@ -128,13 +128,13 @@ def conv_svg(fn, char, glyphnum = None):
8a7942
   if glyphnum == None:
8a7942
     glyphnum = lastglyphnum + 1
8a7942
   lastglyphnum = glyphnum
8a7942
-  print 'StartChar:', os.path.basename(fn)[:-4]
8a7942
-  print 'Encoding: %d %d %d' % (char, glyphnum, char)
8a7942
-  print 'Width: %d' % (21 * 40)
8a7942
-  print 'Flags: W'
8a7942
-  print 'LayerCount: 2'
8a7942
-  print 'Fore'
8a7942
-  print 'SplineSet'
8a7942
+  print('StartChar:', os.path.basename(fn)[:-4])
8a7942
+  print('Encoding: %d %d %d' % (char, glyphnum, char))
8a7942
+  print('Width: %d' % (21 * 40))
8a7942
+  print('Flags: W')
8a7942
+  print('LayerCount: 2')
8a7942
+  print('Fore')
8a7942
+  print('SplineSet')
8a7942
   doc = xml.dom.minidom.parse(fn)
8a7942
   # TODO: reverse paths if fill color is white-ish (this is more code,
8a7942
   # and in the meantime, we'll rely on correct path direction in FF)
8a7942
@@ -147,16 +147,16 @@ def conv_svg(fn, char, glyphnum = None):
8a7942
     cy = float(circle.getAttribute('cy'))
8a7942
     r = float(circle.getAttribute('r'))
8a7942
     circle_to_sfd(cx, cy, r)
8a7942
-  print 'EndSplineSet'
8a7942
-  print 'EndChar'
8a7942
+  print('EndSplineSet')
8a7942
+  print('EndChar')
8a7942
 
8a7942
 def print_header():
8a7942
   global header_printed
8a7942
-  print '''SplineFontDB: 3.0
8a7942
+  print('''SplineFontDB: 3.0
8a7942
 FontName: %s
8a7942
 FullName: %s
8a7942
-FamilyName: %s''' % (font_name, font_name, font_name)
8a7942
-  print '''Weight: Medium
8a7942
+FamilyName: %s''' % (font_name, font_name, font_name))
8a7942
+  print('''Weight: Medium
8a7942
 Copyright: Copyright (C) 2011 Google Inc.
8a7942
 Version: 001.000
8a7942
 UnderlinePosition: -120
8a7942
@@ -180,12 +180,12 @@ HheadAOffset: 0
8a7942
 HheadDescent: 200
8a7942
 HheadDOffset: 0
8a7942
 BeginChars: 57600 57600
8a7942
-'''
8a7942
+''')
8a7942
   header_printed = True
8a7942
 
8a7942
 def print_footer():
8a7942
-  print '''EndChars
8a7942
-EndSplineFont'''
8a7942
+  print('''EndChars
8a7942
+EndSplineFont''')
8a7942
 
8a7942
 def parse_int(x):
8a7942
   if x.startswith('0x'):
8a7942
@@ -197,7 +197,7 @@ def run_file(fn):
8a7942
   global char_num
8a7942
   global font_name
8a7942
   directory = ''
8a7942
-  for l in file(fn).xreadlines():
8a7942
+  for l in file(fn):
8a7942
     if l.startswith('#'):
8a7942
       continue
8a7942
     s = l.strip().split()
8a7942
diff --git a/pycontrib/webcollab.py b/pycontrib/webcollab.py
73cd69
index 9ee0f17..4be07ec 100755
8a7942
--- a/pycontrib/webcollab.py
8a7942
+++ b/pycontrib/webcollab.py
8a7942
@@ -1,4 +1,4 @@
8a7942
-#!/usr/bin/python
8a7942
+#!/usr/bin/python3
8a7942
 # -*- coding: utf-8 -*-
8a7942
 """
8a7942
 running web collab server hooks
73cd69
@@ -44,8 +44,8 @@ def startWebServerInCollabMode(data = None, glyphOrFont = None):
73cd69
     global child
73cd69
     global childNodejs
73cd69
     ensureChildClosed()
73cd69
-    print("FONTFORGE:" + FONTFORGE)
73cd69
-    print("script path:" + collabpath + "web-test-collab.py")
73cd69
+    print(("FONTFORGE:" + FONTFORGE))
73cd69
+    print(("script path:" + collabpath + "web-test-collab.py"))
73cd69
     child = subprocess.Popen( [ FONTFORGE, "-forceuihidden", "-script", collabpath + "web-test-collab.py" ] )
73cd69
     #
73cd69
     # start the nodejs server
8a7942
-- 
73cd69
2.9.3
8a7942