Description: Additional porting to python3
Author: Alastair McKinstry <mckinstry@debian.org>
Last-Updated: 2019-09-27
Forwarded: no

Index: vistrails-3.0~git+9dc22bd/scripts/sql_delete.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/sql_delete.py
+++ vistrails-3.0~git+9dc22bd/scripts/sql_delete.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -38,13 +38,13 @@ import sys
 if '/vistrails/src/trunk/vistrails' not in sys.path:
     sys.path.append('/vistrails/src/trunk/vistrails')
 import vistrails.db.services.io
-import urlparse
+import urllib.parse
 import getpass
 
 def run(url, type, id):
     scheme, rest = url.split('://', 1)
     url = 'http://' + rest
-    (_, net_loc, db_name, args_str, _) = urlparse.urlsplit(url)
+    (_, net_loc, db_name, args_str, _) = urllib.parse.urlsplit(url)
     db_name = db_name[1:]
     net_loc_arr = net_loc.split('@',1)
     if len(net_loc_arr) > 1:
@@ -62,7 +62,7 @@ def run(url, type, id):
 
     config = {'host': host, 'port': int(port),
               'user': user, 'db': db_name}
-    print config
+    print (config)
     try:
         conn = vistrails.db.services.io.open_db_connection(config)
     except Exception:
@@ -74,9 +74,9 @@ def run(url, type, id):
 
 if __name__ == '__main__':
     if len(sys.argv) < 4:
-        print "Usage: %s %s <db_connection_str> <type> <id>" % \
-            (sys.executable, sys.argv[0])
-        print "   <db_connection_str> := [<user>@]<host>[:<port>]/<db>"
-        print "   Password prompt displayed if required"
+        print(("Usage: %s %s <db_connection_str> <type> <id>" % \
+            (sys.executable, sys.argv[0])))
+        print ("   <db_connection_str> := [<user>@]<host>[:<port>]/<db>")
+        print ("   Password prompt displayed if required")
         sys.exit(61)
     run(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/sql_to_xml.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/sql_to_xml.py
+++ vistrails-3.0~git+9dc22bd/scripts/sql_to_xml.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -50,8 +50,8 @@ def convert_sql_to_xml(filename, id):
         vistrail = io.open_vistrail_from_db(db_connection, id)
         io.save_vistrail_to_xml(vistrail, filename)
         io.close_db_connection(db_connection)
-    except MySQLdb.Error, e:
-        print e
+    except MySQLdb.Error as e:
+        print(e)
 
 if __name__ == '__main__':
     convert_sql_to_xml('/tmp/vt_from_db.xml', 4)
Index: vistrails-3.0~git+9dc22bd/scripts/system_info.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/system_info.py
+++ vistrails-3.0~git+9dc22bd/scripts/system_info.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -39,49 +39,49 @@
 import sys
 import platform
 
-print "Python:"
-print "  Basic version: %s.%s.%s" % (sys.version_info[0],
+print("Python:")
+print("  Basic version: %s.%s.%s" % (sys.version_info[0],
                                      sys.version_info[1],
-                                     sys.version_info[2], )
-print "  Full version: " + sys.version.replace('\n', ' ')
-print
+                                     sys.version_info[2], ))
+print("  Full version: " + sys.version.replace('\n', ' '))
+print()
 
 def c(s):
     return s or "<COULD NOT DETERMINE>"
 
-print "System:"
-print "  Type: " + c(platform.system())
-print "  Architecture: " + c(platform.architecture()[0])
-print "  Machine: " + c(platform.machine())
-print "  Platform: " + c(platform.platform())
-print "  Processor: " + c(platform.processor())
-print
+print("System:")
+print("  Type: " + c(platform.system()))
+print("  Architecture: " + c(platform.architecture()[0]))
+print("  Machine: " + c(platform.machine()))
+print("  Platform: " + c(platform.platform()))
+print("  Processor: " + c(platform.processor()))
+print()
 
 ##############################################################################
 
-print "Libraries:"
+print("Libraries:")
 
 try:
     import sip
-    print "  sip installed."
-    print "    version: " + sip.SIP_VERSION_STR
+    print("  sip installed.")
+    print("    version: " + sip.SIP_VERSION_STR)
 except ImportError:
-    print "  sip NOT installed."
-print
+    print("  sip NOT installed.")
+print()
 
 try:
     import PyQt4.Qt
-    print "  PyQt installed."
-    print "    Qt version: " + PyQt4.Qt.QT_VERSION_STR
-    print "    PyQt version: " + PyQt4.Qt.PYQT_VERSION_STR
+    print("  PyQt installed.")
+    print("    Qt version: " + PyQt4.Qt.QT_VERSION_STR)
+    print("    PyQt version: " + PyQt4.Qt.PYQT_VERSION_STR)
 except ImportError:
-    print "  PyQt NOT installed."
-print
+    print("  PyQt NOT installed.")
+print()
 
 try:
     import vtk
-    print "  VTK installed."
-    print "    VTK short version: " + vtk.vtkVersion().GetVTKVersion()
-    print "    VTK full version: " + vtk.vtkVersion().GetVTKSourceVersion()
+    print("  VTK installed.")
+    print("    VTK short version: " + vtk.vtkVersion().GetVTKVersion())
+    print("    VTK full version: " + vtk.vtkVersion().GetVTKSourceVersion())
 except ImportError:
-    print "  VTK NOT installed."
+    print("  VTK NOT installed.")
Index: vistrails-3.0~git+9dc22bd/scripts/update_copyright_year.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/update_copyright_year.py
+++ vistrails-3.0~git+9dc22bd/scripts/update_copyright_year.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -39,7 +39,7 @@
 year with 2008 in the file header.
 """
 
-from itertools import izip
+
 import os
 import re
 
@@ -65,15 +65,15 @@ for (path, dnames, fnames) in os.walk('.
             files.append(os.path.join(path, fn))
 
 # Go through files and update them
-print "%d files found" % len(files)
+print("%d files found" % len(files))
 count = 0
 for fname in files:
     fp = open(fname, 'rb')
     try:
         # Search only in the first few lines
-        for line_num, line in izip(xrange(NB_SEARCHED_LINES), fp):
+        for line_num, line in zip(range(NB_SEARCHED_LINES), fp):
             if RE_COPYRIGHT.search(line):
-                print "Updating %s" % fname
+                print("Updating %s" % fname)
                 fp.seek(0)
                 lines = fp.readlines()
                 fp.close()
@@ -84,4 +84,4 @@ for fname in files:
                 break
     finally:
         fp.close()
-print "%d files updated" % count
+print("%d files updated" % count)
Index: vistrails-3.0~git+9dc22bd/scripts/update_db.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/update_db.py
+++ vistrails-3.0~git+9dc22bd/scripts/update_db.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -55,7 +55,7 @@ def update_db(config, new_version=None,
         new_version = currentVersion
     if tmp_dir is None:
         tmp_dir = tempfile.mkdtemp(prefix='vt_db')
-        print 'creating tmpdir:', tmp_dir
+        print('creating tmpdir:', tmp_dir)
 
     db_connection = io.open_db_connection(config)
     obj_id_lists = {}
@@ -72,12 +72,12 @@ def update_db(config, new_version=None,
         # read data out of database
         thumbnail_dir = os.path.join(tmp_dir, 'thumbs')
         os.mkdir(thumbnail_dir)
-        for obj_type, obj_ids in obj_id_lists.iteritems():
+        for obj_type, obj_ids in obj_id_lists.items():
             for (obj_id, _, _) in obj_ids:
                 old_version = io.get_db_object_version(db_connection, obj_id, 
                                                        'vistrail')
 
-                print 'getting', obj_type, 'id', obj_id
+                print('getting', obj_type, 'id', obj_id)
                 local_tmp_dir = os.path.join(tmp_dir, str(obj_id))
                 vt_name = os.path.join(tmp_dir, str(obj_id) + '.vt')
                 try:
@@ -87,7 +87,7 @@ def update_db(config, new_version=None,
                     os.mkdir(local_tmp_dir)
                 except:
                     import traceback
-                    print "Could not read:", traceback.format_exc()
+                    print("Could not read:", traceback.format_exc())
                     continue
                 io.save_vistrail_bundle_to_zip_xml(res, vt_name, local_tmp_dir)
 
@@ -100,9 +100,9 @@ def update_db(config, new_version=None,
         (res, _) = io.open_vistrail_bundle_from_zip_xml(filename)
         try:
             io.save_vistrail_bundle_to_db(res, db_connection, 'with_ids')
-        except Exception, e:
+        except Exception as e:
             import traceback
-            print filename, e, traceback.format_exc()
+            print(filename, e, traceback.format_exc())
     io.close_db_connection(db_connection)
 
 if __name__ == '__main__':
Index: vistrails-3.0~git+9dc22bd/scripts/update_email_contact.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/update_email_contact.py
+++ vistrails-3.0~git+9dc22bd/scripts/update_email_contact.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -55,7 +55,7 @@ for (path, dnames, fnames) in os.walk('.
                 files.append(os.path.join(path, fn))
                 break
 
-print len(files), " files will be processed."
+print(len(files), " files will be processed.")
 
 count = 0
 for fname in files:
@@ -64,10 +64,10 @@ for fname in files:
     fin.close()
     pos = all_lines.find(OLD_EMAIL)
     if pos > -1:
-        print "Updating: %s"%fname
+        print("Updating: %s"%fname)
         newlines = all_lines.replace(OLD_EMAIL, NEW_EMAIL)
         fout = file(fname, 'w')
         fout.write(newlines)
         fout.close()
         count += 1
-print count, " files updated "
+print(count, " files updated ")
Index: vistrails-3.0~git+9dc22bd/scripts/update_to_mod_bsd_license.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/update_to_mod_bsd_license.py
+++ vistrails-3.0~git+9dc22bd/scripts/update_to_mod_bsd_license.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -237,7 +237,7 @@ def process_files(files, old_license, ne
         pos = all_lines.find(old_license)
         pos_gen = all_lines.find("GNU General Public")
         if pos > -1:
-            print "Updating: %s"%fname
+            print("Updating: %s"%fname)
             newlines = all_lines.replace(old_license, new_license)
             fout = file(fname, 'w')
             fout.write(newlines)
@@ -248,16 +248,16 @@ def process_files(files, old_license, ne
                 gpl_found.append(fname)
             else:
                 if all_lines.find(new_license) == -1:
-                    print "Appending license to %s"%fname
+                    print("Appending license to %s"%fname)
                     newlines = new_license+"\n"+all_lines
                     fout = file(fname, 'w')
                     fout.write(newlines)
                     fout.close()
                     count +=1
-    print count, " %s files updated"%type
-    print " found reference to gpl in the following files:"
+    print(count, " %s files updated"%type)
+    print(" found reference to gpl in the following files:")
     for fname in gpl_found:
-        print "  ", fname
+        print("  ", fname)
 
 py_files = []
 xml_files = []
@@ -277,16 +277,16 @@ for (path, dnames, fnames) in os.walk('.
         else:
             others.append(os.path.join(path,fn))
 
-print len(py_files), " python files found"
+print(len(py_files), " python files found")
 process_files(py_files, py_old_license, py_bsd_3_license, 'python')
 
-print len(sql_files), " sql files found"
+print(len(sql_files), " sql files found")
 process_files(sql_files, sql_old_license, sql_bsd_3_license, 'sql')
 
-print len(xml_files), " xml files found"
+print(len(xml_files), " xml files found")
 process_files(xml_files, xml_old_license, xml_bsd_3_license, 'xml')
 
-print len(php_files), " php files found"
+print(len(php_files), " php files found")
 process_files(php_files, php_old_license, php_bsd_3_license, 'php')
 
 #print "Ignored files: "
Index: vistrails-3.0~git+9dc22bd/scripts/watch_vistrail_servers.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/watch_vistrail_servers.py
+++ vistrails-3.0~git+9dc22bd/scripts/watch_vistrail_servers.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -34,7 +34,7 @@
 ## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
 ##
 ###############################################################################
-import xmlrpclib
+import xmlrpc.client
 import os
 from subprocess import Popen, PIPE
 from time import sleep
@@ -73,7 +73,7 @@ class VistrailWatcher(object):
 
         # create proxies
         for port in self.ports:
-            self.proxies[port] = xmlrpclib.ServerProxy("http://%s:%d" % \
+            self.proxies[port] = xmlrpc.client.ServerProxy("http://%s:%d" % \
                                                        (self.server, port))
             self.is_down[port] = False
 
@@ -125,7 +125,7 @@ class VistrailWatcher(object):
         try:
             Popen(args)
             sleep(20)
-        except Exception, e:
+        except Exception as e:
             self.logger.error("Couldn't start the instance on display:"
                               "%s port: %s") % (instance_virtual_display, port)
             self.logger.error(str(e))
@@ -135,7 +135,7 @@ class VistrailWatcher(object):
 
         if not self.ports:
             self.logger.info("no running instances found")
-            print "no running instances found"
+            print("no running instances found")
             return
 
         self.logger.info("watching %s" % str(self.ports))
@@ -153,7 +153,7 @@ class VistrailWatcher(object):
                         if self.is_down[port]:
                             self.logger.info("%s:%d is back up" % (self.server, port))
                         self.is_down[port] = False
-                except Exception, e:
+                except Exception as e:
                     if not self.is_down[port]:
                         # first time down, send email
                         self.send_email("%s:%d is down" % (self.server, port))
Index: vistrails-3.0~git+9dc22bd/scripts/convert_files/fix_file.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/convert_files/fix_file.py
+++ vistrails-3.0~git+9dc22bd/scripts/convert_files/fix_file.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -40,15 +40,15 @@ import re
 re_list = []
 
 if len(sys.argv) < 4:
-    print "Usage:"
-    print "%s file_to_process path_to_data_files data_file_1 data_file_2 ..." % sys.argv[0]
+    print("Usage:")
+    print("%s file_to_process path_to_data_files data_file_1 data_file_2 ..." % sys.argv[0])
     sys.exit(1)
 
-for i in xrange(3, len(sys.argv)):
+for i in range(3, len(sys.argv)):
     re_list.append((sys.argv[i], re.compile(r"val='[^']*" + sys.argv[i] + r"[^']*'")))
 
 f = file(sys.argv[1])
 for l in f:
     for (s, re_obj) in re_list:
         l = re_obj.sub("val='" + sys.argv[2] + s + "'", l)
-    print l[:-1]
+    print(l[:-1])
Index: vistrails-3.0~git+9dc22bd/scripts/create_release_wiki_table.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/create_release_wiki_table.py
+++ vistrails-3.0~git+9dc22bd/scripts/create_release_wiki_table.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -120,7 +120,7 @@ def create_text():
 |.pdf
 |-
 """%(SF_DOWNLOAD_URL, USERSGUIDE, USERSGUIDE, USERSGUIDE_SIZE)
-    print text
+    print(text)
 
 if __name__ == "__main__":
     create_text()
Index: vistrails-3.0~git+9dc22bd/scripts/create_server_media_dir_structure.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/create_server_media_dir_structure.py
+++ vistrails-3.0~git+9dc22bd/scripts/create_server_media_dir_structure.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -69,33 +69,33 @@ if __name__ == "__main__":
     if len(args) == 2:
         media_dir = args[1]
     else:
-        print "Usage: %s /path/to/media_dir" % args[0]
+        print("Usage: %s /path/to/media_dir" % args[0])
         sys.exit(0)
     if os.path.exists(media_dir):
         if not os.path.isdir(media_dir):
-            print "Error: %s exists and it is not a directory." %media_dir
+            print("Error: %s exists and it is not a directory." %media_dir)
             error = True
         elif path_exists_and_not_empty(media_dir):
-            print "Error: %s exists and it is not empty. "% media_dir
+            print("Error: %s exists and it is not empty. "% media_dir)
             error = True
     else:
-        print "%s does not exist. Trying to create directory..."%media_dir
+        print("%s does not exist. Trying to create directory..."%media_dir)
         try:
             os.mkdir(media_dir)
-        except Exception, e:
-            print "Error creating %s directory: %s" % (media_dir, str(e))
+        except Exception as e:
+            print("Error creating %s directory: %s" % (media_dir, str(e)))
             error = True
     if not error:
-        print "Creating inner structure... "
+        print("Creating inner structure... ")
         for path_list in folders:
             folder = os.path.join(media_dir, os.path.join(*path_list))
-            print "   ", folder
+            print("   ", folder)
             try:
                 os.makedirs(folder)
-            except Exception, e:
-                print "Error creating %s directory: %s" % (folder, str(e))
-        print "Done."
+            except Exception as e:
+                print("Error creating %s directory: %s" % (folder, str(e)))
+        print("Done.")
     else:
-        print "There was an error. Please check the messages above. "
+        print("There was an error. Please check the messages above. ")
         sys.exit(1)
     
Index: vistrails-3.0~git+9dc22bd/scripts/db_utils.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/db_utils.py
+++ vistrails-3.0~git+9dc22bd/scripts/db_utils.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -43,7 +44,7 @@ def usage(usageDict):
     unrequired = ''
     required = ''
     align_len = 15
-    for (opt, info) in usageDict.iteritems():
+    for (opt, info) in usageDict.items():
         if info[1]:
             required += '-%s <%s> ' % (opt[0], info[2])
             usageStr += '    -%s <%s> %s' % (opt[0], info[2], 
@@ -59,11 +60,11 @@ def usage(usageDict):
                 unrequired += '[-%s] ' % opt[0]
                 usageStr += '    -%s %s' % (opt[0], ' ' * align_len)
         usageStr += '%s\n' % info[0]
-    print 'Usage: %s %s %s%s\n%s' % (sys.executable,
+    print('Usage: %s %s %s%s\n%s' % (sys.executable,
                                      sys.argv[0],
                                      required, 
                                      unrequired, 
-                                     usageStr)
+                                     usageStr))
 
 def parse_db_cmd_line(argv, more_options={}):
     options = {}
@@ -74,9 +75,9 @@ def parse_db_cmd_line(argv, more_options
                     }
     optionsUsage.update(more_options)
 
-    optStr = ''.join(optionsUsage.keys())
+    optStr = ''.join(list(optionsUsage.keys()))
     optKeys = optStr.replace(':','')
-    for idx in xrange(len(optKeys)):
+    for idx in range(len(optKeys)):
         options[optKeys[idx]] = False
 
     try:
@@ -90,7 +91,7 @@ def parse_db_cmd_line(argv, more_options
         usage(optionsUsage)
         sys.exit(23)
 
-    for opt, spec in optionsUsage.iteritems():
+    for opt, spec in optionsUsage.items():
         if spec[1] and not options[opt[0]]:
             usage(optionsUsage)
             sys.exit(23)
Index: vistrails-3.0~git+9dc22bd/scripts/diff_package.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/diff_package.py
+++ vistrails-3.0~git+9dc22bd/scripts/diff_package.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -72,32 +72,32 @@ def diff_package(pkg_id, reg_fname1, reg
             for ps in d2.port_specs_list:
                 d2_port_specs[(ps.name, ps.type)] = ps.sigstring
             d2_port_specs_set = set(d2_port_specs.keys())
-            for ps_id, sig1 in d1_port_specs.iteritems():
+            for ps_id, sig1 in d1_port_specs.items():
                 if ps_id not in d2_port_specs:
-                    print "added %s port: %s:%s" % \
-                        (ps_id[1], get_module_name(d1), ps_id[0])
+                    print("added %s port: %s:%s" % \
+                        (ps_id[1], get_module_name(d1), ps_id[0]))
                     continue
                 d2_port_specs_set.discard(ps_id)
                 if sig1 != d2_port_specs[ps_id]:
-                    print "changed %s port: %s:%s" % \
-                        (ps_id[1], get_module_name(d1), ps_id[0])
-                    print "  %s -> %s" % (sig1, d2_port_specs[ps_id])
+                    print("changed %s port: %s:%s" % \
+                        (ps_id[1], get_module_name(d1), ps_id[0]))
+                    print("  %s -> %s" % (sig1, d2_port_specs[ps_id]))
                 else:
                     # equal
                     pass
             for ps_id in d2_port_specs_set:
-                print "deleted %s port: %s:%s" % \
-                    (ps_id[1], get_module_name(d1), ps_id[0])
+                print("deleted %s port: %s:%s" % \
+                    (ps_id[1], get_module_name(d1), ps_id[0]))
             del d2_modules_dict[(d1.identifier, d1.name, d1.namespace)]
         else:
-            print "deleted module: %s" % get_module_name(d1)
-    for d2 in d2_modules_dict.itervalues():
-        print "added module: %s" % get_module_name(d2)
+            print("deleted module: %s" % get_module_name(d1))
+    for d2 in d2_modules_dict.values():
+        print("added module: %s" % get_module_name(d2))
     
 if __name__ == '__main__':
     if len(sys.argv) < 4:
-        print "Usage: %s %s <pkg_identifer> <old_registry> <new_registry>" % \
-            (sys.executable, sys.argv[0])
+        print("Usage: %s %s <pkg_identifer> <old_registry> <new_registry>" % \
+            (sys.executable, sys.argv[0]))
         sys.exit(71)
     vistrails.core.application.init()
     diff_package(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/dist/common/prepare_release.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/dist/common/prepare_release.py
+++ vistrails-3.0~git+9dc22bd/scripts/dist/common/prepare_release.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 # Updates the binary changelogs, version numbers, hash, and branch from CHANGELOG
 # First updates hash in changelog if git is available
 # Run and commit changes to git before building release
@@ -59,7 +59,7 @@ def update_value(fname, pre, value):
         if m is not None:
             lines[i] = rexp.sub(value, line)
             if line != lines[i]:
-                print '%s:\n' % fname, line, lines[i],
+                print('%s:\n' % fname, line, lines[i], end=' ')
             replaced = True
             break
         i += 1
@@ -123,4 +123,4 @@ if __name__ == '__main__':
             '-w', '546',
             'scripts/dist/common/splash/splash.svg'])
     except (OSError, subprocess.CalledProcessError):
-        print "Calling inkscape failed, skipping splash screen update!"
+        print("Calling inkscape failed, skipping splash screen update!")
Index: vistrails-3.0~git+9dc22bd/scripts/dist/mac/fix_itk_libraries.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/dist/mac/fix_itk_libraries.py
+++ vistrails-3.0~git+9dc22bd/scripts/dist/mac/fix_itk_libraries.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -42,8 +42,8 @@ import os.path
 import sys
 
 def usage():
-    print "Usage: "
-    print "   %s path_to_itk_files destination_folder" % sys.argv[0]
+    print("Usage: ")
+    print("   %s path_to_itk_files destination_folder" % sys.argv[0])
     sys.exit(1)
 
 try:
@@ -61,7 +61,7 @@ try:
 except IndexError:
     usage()
 
-print "This will copy the *.dylib to", destination_libs, " and *.so and the python files to ", destination_python_files
+print("This will copy the *.dylib to", destination_libs, " and *.so and the python files to ", destination_python_files)
 
 libnames = re.compile(r'.*\.dylib')
 itklibnames = re.compile(r'(.*emanuele*.*\.dylib) .*')
@@ -80,7 +80,7 @@ def link_or_copy(src, dst):
     # Links if possible, but we're across devices, we need to copy.
     try:
         os.link(src, dst)
-    except OSError, e:
+    except OSError as e:
         if e.errno == 18:
             # Across-device linking is not possible. Let's copy.
             shutil.copyfile(src, dst)
@@ -117,15 +117,15 @@ for f in file_names:
         so_to_visit.add(f)
         
 if len(files_to_visit) == 0:
-    print "looks like you started the script from the wrong directory"
+    print("looks like you started the script from the wrong directory")
     sys.exit(1)
 
 while len(files_to_visit):
     f = files_to_visit.pop()
-    print "Visiting file", f
+    print("Visiting file", f)
     src = os.path.join(path_to_libs,f)
     dst = os.path.join(destination_libs,f)
-    print "Copyng to destination folder..."
+    print("Copyng to destination folder...")
     link_or_copy(src,dst)
     pout, pin = popen2.popen2("otool -L %s" % dst)
     # print pout.readlines()
@@ -146,27 +146,27 @@ while len(files_to_visit):
                 #print "new file!", f
                 result = os.system(cmd_line)
                 if result != 0:
-                    print "Something went wrong with install_name_tool. Ouch."
+                    print("Something went wrong with install_name_tool. Ouch.")
                     sys.exit(1)
 
 # creating symbolic links
 cur_dir = os.getcwd()
 os.chdir(destination_libs)
-print "Creating symbolic links in %s " % os.getcwd()
+print("Creating symbolic links in %s " % os.getcwd())
 while len(links_to_visit):
     f = links_to_visit.pop()
     src = os.readlink(os.path.join(path_to_libs,f))
-    print "  ", f, " -> " , src
+    print("  ", f, " -> " , src)
     os.symlink(src,f)
     
 os.chdir(cur_dir)
-print "Dealing with *.so files... "
+print("Dealing with *.so files... ")
 while len(so_to_visit):
     f = so_to_visit.pop()
-    print "Visiting file", f
+    print("Visiting file", f)
     src = os.path.join(path_to_libs,f)
     dst = os.path.join(destination_python_files,f)
-    print "Copyng to destination folder..."
+    print("Copyng to destination folder...")
     link_or_copy(src,dst)
     pout, pin = popen2.popen2("otool -L %s" % dst)
     # print pout.readlines()
@@ -187,20 +187,20 @@ while len(so_to_visit):
                 #print "new file!", f
                 result = os.system(cmd_line)
                 if result != 0:
-                    print "Something went wrong with install_name_tool. Ouch."
+                    print("Something went wrong with install_name_tool. Ouch.")
                     sys.exit(1)
                     
 #copying python files
-print "copying python files... "
+print("copying python files... ")
 src = os.path.join(path_to_python_files,'*')
 os.system("cp -r %s %s" % (src, destination_python_files))    
 
-print "copying  python files in %s..." % path_to_libs
+print("copying  python files in %s..." % path_to_libs)
 src = os.path.join(path_to_libs,'*.py')
 os.system("cp %s %s" % (src, destination_python_files))    
 
-print "copying static libs..." 
+print("copying static libs...") 
 src = os.path.join(path_to_libs, "*.a")
 os.system("cp %s %s" % (src, destination_libs))
 
-print "Done with ITK."
+print("Done with ITK.")
Index: vistrails-3.0~git+9dc22bd/scripts/dist/mac/fix_qtplugin_libs.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/dist/mac/fix_qtplugin_libs.py
+++ vistrails-3.0~git+9dc22bd/scripts/dist/mac/fix_qtplugin_libs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -54,8 +54,8 @@ import os.path
 import sys
 
 def usage():
-    print "Usage: "
-    print "   %s path_to_dylibs" % sys.argv[0]
+    print("Usage: ")
+    print("   %s path_to_dylibs" % sys.argv[0])
     sys.exit(1)
 
 try:
@@ -64,7 +64,7 @@ try:
 except IndexError:
     usage()
 
-print "This will modify the *.dylibs in ", path_to_libs
+print("This will modify the *.dylibs in ", path_to_libs)
 
 libnames = re.compile(r'.*\.dylib')
 libnames_otool = re.compile(r'(.*\.dylib) (\(.+\))')
@@ -87,7 +87,7 @@ def link_or_copy(src, dst):
     # Links if possible, but we're across devices, we need to copy.
     try:
         os.link(src, dst)
-    except OSError, e:
+    except OSError as e:
         if e.errno == 18:
             # Across-device linking is not possible. Let's copy.
             shutil.copyfile(src, dst)
@@ -122,12 +122,12 @@ for f in file_names:
             links_to_visit.add(f)
 
 if len(files_to_visit) == 0:
-    print "looks like you started the script from the wrong directory"
+    print("looks like you started the script from the wrong directory")
     sys.exit(1)
 
 while len(files_to_visit):
     f = files_to_visit.pop()
-    print "Visiting file", f
+    print("Visiting file", f)
     src = os.path.join(path_to_libs,f)
 
     pout, pin = popen2.popen2("otool -L %s" % src)
@@ -143,7 +143,7 @@ while len(files_to_visit):
             #print "id_cmd_line ", id_cmd_line
             result = os.system(id_cmd_line)
             if result != 0:
-                print "Something went wrong with install_name_tool. Ouch."
+                print("Something went wrong with install_name_tool. Ouch.")
                 sys.exit(1)
     for l in lines[2:]:
         
@@ -165,7 +165,7 @@ while len(files_to_visit):
                 #print "new file!", f
                 result = os.system(cmd_line)
                 if result != 0:
-                    print "Something went wrong with install_name_tool. Ouch."
+                    print("Something went wrong with install_name_tool. Ouch.")
                     sys.exit(1)
 
 # creating symbolic links
@@ -180,4 +180,4 @@ while len(files_to_visit):
 #os.chdir(cur_dir)
 
 
-print "Done."
+print("Done.")
Index: vistrails-3.0~git+9dc22bd/scripts/dist/source/make-vistrails-src-build.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/dist/source/make-vistrails-src-build.py
+++ vistrails-3.0~git+9dc22bd/scripts/dist/source/make-vistrails-src-build.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###########################################################
 # Builds Source Release and uploads to Sourceforge        #
 # Author: Daniel S. Rees (Modified by Tommy Ellqvist)     #
@@ -104,12 +104,12 @@ if __name__ == "__main__":
                             stderr=subprocess.STDOUT)
     proc.wait()
     if proc.returncode != 0:
-        print "ERROR: preparing release."
+        print("ERROR: preparing release.")
         if proc.stdout:
-            print proc.stdout.readlines()
+            print(proc.stdout.readlines())
         sys.exit(1)
 
-    print "Creating tarball: '%s' ..." % TARBALL_FILENAME
+    print("Creating tarball: '%s' ..." % TARBALL_FILENAME)
     tarball = None
     try:
         tarball = tarfile.open(TARBALL_FILENAME, "w:gz")
@@ -124,7 +124,7 @@ if __name__ == "__main__":
         for fname in EXPORT_PATHS:
             tarball.add(fname, filter=filter_)
     except:
-        print "ERROR: Failed to create tarball"
+        print("ERROR: Failed to create tarball")
         raise
     finally:
         if tarball is not None:
@@ -136,25 +136,25 @@ if __name__ == "__main__":
         upload_attempts = 0
         while not uploaded and upload_attempts < SF_UPLOAD_ATTEMPTS:
             upload_attempts += 1
-            print "Uploading tarball to Sourceforge (attempt %d of %d): '%s' ..." % (upload_attempts, SF_UPLOAD_ATTEMPTS, SF_UPLOAD_CMD)
+            print("Uploading tarball to Sourceforge (attempt %d of %d): '%s' ..." % (upload_attempts, SF_UPLOAD_ATTEMPTS, SF_UPLOAD_CMD))
             try:
                 upload_proc = subprocess.Popen(SF_UPLOAD_CMD, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
                 upload_log = upload_proc.communicate()[0]
                 # Indent upload log and print
                 upload_log = "\n".join(['    ' + line for line in upload_log.splitlines()])
-                print "Sourceforge Upload Log (attempt %d of %d):\n%s" % (upload_attempts, SF_UPLOAD_ATTEMPTS, upload_log)
+                print("Sourceforge Upload Log (attempt %d of %d):\n%s" % (upload_attempts, SF_UPLOAD_ATTEMPTS, upload_log))
                 if upload_proc.returncode != 0:
                     raise Exception("Tarball upload (attempt %d of %d) failed with return code: %s" % (upload_attempts, SF_UPLOAD_ATTEMPTS, upload_proc.returncode))
                 else:
-                    print "Tarball upload completed on attempt %d of %d." % (upload_attempts, SF_UPLOAD_ATTEMPTS)
+                    print("Tarball upload completed on attempt %d of %d." % (upload_attempts, SF_UPLOAD_ATTEMPTS))
                     uploaded = True
-            except Exception, e:
+            except Exception as e:
                 if upload_attempts == SF_UPLOAD_ATTEMPTS:
-                    print "ERROR: Could not upload to sourceforge"
+                    print("ERROR: Could not upload to sourceforge")
                 else:
-                    print e.args[0]
-        print "tarball uploaded to Sourceforge, deleting local tarball"
+                    print(e.args[0])
+        print("tarball uploaded to Sourceforge, deleting local tarball")
         if os.path.isfile(TARBALL_FILENAME):
             os.remove(TARBALL_FILENAME)
 
-    print "Completed Source Build"
+    print("Completed Source Build")
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/check_diffs.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/check_diffs.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/check_diffs.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -70,11 +70,11 @@ def run(in_dir, out_dir):
         other_fname = os.path.join(out_dir, path_end)
 
         cmd_line = "diff %s %s" % (fname, other_fname)
-        print cmd_line
+        print(cmd_line)
         os.system(cmd_line)
 
 if __name__ == '__main__':
     if len(sys.argv) < 3:
-        print 'Usage: python %s <in_directory> <out_directory>' % sys.argv[0]
+        print('Usage: python %s <in_directory> <out_directory>' % sys.argv[0])
         sys.exit(-1)
     run(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/convert_to_vt.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/convert_to_vt.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/convert_to_vt.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -53,47 +53,45 @@ class ConvertVTKToVT(object):
                 if line.startswith('#!'):
                     found_starter = True
                 else:
-                    print >> out_file, \
-                        "# This file produced automatically by convert_to_vt.py\n# "
+                    print("# This file produced automatically by convert_to_vt.py\n# ", file=out_file)
             elif line_count == 1 and found_starter:
-                print >> out_file, \
-                    "# This file produced automatically by convert_to_vt.py\n# "
+                print("# This file produced automatically by convert_to_vt.py\n# ", file=out_file)
                 found_starter = False
                 
             if (line.find('import ') != -1 and line.find('vtk') != -1) or \
                     line.find('VTK_DATA_ROOT = ') != -1 or \
                     does_continue:
                 if line.rstrip() == 'import vtk':
-                    print >>out_file, 'import sys'
-                    print >>out_file, 'sys.path.append' + \
-                        '("/vistrails/src/trunk/scripts/gen_vtk_examples")'
-                    print >>out_file, 'import vtk_imposter'
-                    print >>out_file, 'from colors import *'
-                    print >>out_file, 'vtk = vtk_imposter.vtk()'
-                    print >>out_file, 'VTK_DATA_ROOT = ""'
-                    print >>out_file, ''
-                    print >>out_file, '#', line[:-1]
+                    print('import sys', file=out_file)
+                    print('sys.path.append' + \
+                        '("/vistrails/src/trunk/scripts/gen_vtk_examples")', file=out_file)
+                    print('import vtk_imposter', file=out_file)
+                    print('from colors import *', file=out_file)
+                    print('vtk = vtk_imposter.vtk()', file=out_file)
+                    print('VTK_DATA_ROOT = ""', file=out_file)
+                    print('', file=out_file)
+                    print('#', line[:-1], file=out_file)
                 else:
                     if line.rstrip()[-1] == '\\':
                         does_continue = True
                     else:
                         does_continue = False
-                    print >>out_file, '#', line[:-1]
+                    print('#', line[:-1], file=out_file)
             else:
                 out_file.write(line)
             line_count += 1
-        print >>out_file, '\nif len(sys.argv) > 1:'
-        print >>out_file, '    out_filename = sys.argv[1]'
-        print >>out_file, 'else:'
-        print >>out_file, '    out_filename = None'
-        print >>out_file, 'vtk.to_vt(out_filename)'
+        print('\nif len(sys.argv) > 1:', file=out_file)
+        print('    out_filename = sys.argv[1]', file=out_file)
+        print('else:', file=out_file)
+        print('    out_filename = None', file=out_file)
+        print('vtk.to_vt(out_filename)', file=out_file)
         out_file.close()
             
 
 if __name__ == '__main__':
     import sys
     if len(sys.argv) < 3:
-        print 'Usage: %s <in_file> <out_py_file>' % sys.argv[0]
+        print('Usage: %s <in_file> <out_py_file>' % sys.argv[0])
         sys.exit(0)
     converter = ConvertVTKToVT(*sys.argv[1:])
     converter.run()
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/copy_vtk_examples.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/copy_vtk_examples.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/copy_vtk_examples.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -90,12 +90,12 @@ def run(in_dir, out_dir):
         converter = ConvertVTKToVT(fname, out_py_name)
         converter.run()
 
-        print >>sys.stderr, "running 'python %s %s'..." % (out_py_name,
-                                                           out_vt_name)
+        print("running 'python %s %s'..." % (out_py_name,
+                                                           out_vt_name), file=sys.stderr)
         os.system('python %s %s' % (out_py_name, out_vt_name))
 
 if __name__ == '__main__':
     if len(sys.argv) < 3:
-        print 'Usage: %s <in_directory> <out_directory>' % sys.argv[0]
+        print('Usage: %s <in_directory> <out_directory>' % sys.argv[0])
         sys.exit(-1)
     run(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/gen_vtk_examples.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/gen_vtk_examples.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/gen_vtk_examples.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -46,7 +46,7 @@ def run(begin_dir, intermediate_dir, out
     
 if __name__ == '__main__':
     if len(sys.argv) < 4:
-        print "Usage: python %s " % sys.argv[0] + \
-            "<begin_dir> <intermediate_dir> <out_dir> [examples_list]"
+        print("Usage: python %s " % sys.argv[0] + \
+            "<begin_dir> <intermediate_dir> <out_dir> [examples_list]")
         sys.exit(-1)
     run(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/get_vtk_examples.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/get_vtk_examples.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/get_vtk_examples.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -72,11 +72,11 @@ def run(py_dirname, in_dirname, out_dirn
             # print "os.system('cp %s %s')" % (vt_name, out_vt_name)
             os.system('cp %s %s' % (py_name, out_py_name))
             os.system('cp %s %s' % (vt_name, out_vt_name))
-    print "%d of %d" % (total_good, total)
+    print("%d of %d" % (total_good, total))
 
 if __name__ == '__main__':
     if len(sys.argv) < 5:
-        print "Usage: python %s " % sys.argv[0] + \
-            "<python_dir> <in_dir> <out_dir> [examples_list]"
+        print("Usage: python %s " % sys.argv[0] + \
+            "<python_dir> <in_dir> <out_dir> [examples_list]")
         sys.exit(-1)
     run(*sys.argv[1:])
Index: vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/vtk_to_vt.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/gen_vtk_examples/vtk_to_vt.py
+++ vistrails-3.0~git+9dc22bd/scripts/gen_vtk_examples/vtk_to_vt.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -41,7 +42,7 @@ os.environ['EXECUTABLEPATH'] = ""
 import copy
 import datetime
 import re
-import urllib
+import urllib.request, urllib.parse, urllib.error
 
 from vistrails.db.domain import DBModule, DBConnection, DBPort, DBFunction, \
     DBParameter, DBLocation, DBPortSpec, DBTag, DBAnnotation, DBVistrail, \
@@ -234,12 +235,12 @@ class VTK2VT(object):
 
     def save_modules(self):
         self.saved_functions = {}
-        for k, module in self.vtk_modules.iteritems():
+        for k, module in self.vtk_modules.items():
             self.saved_functions[k] = module.functions
             module.functions = []
             
     def restore_modules(self):
-        for k, module in self.vtk_modules.iteritems():
+        for k, module in self.vtk_modules.items():
             module.functions = self.saved_functions[k]
     
     def do_layout(self):
@@ -249,7 +250,7 @@ class VTK2VT(object):
         vt_f_connections = self.vt_b_connections
         b_connections = copy.deepcopy(vt_b_connections)
         f_connections = copy.deepcopy(vt_f_connections)
-        for m_id, module in self.vt_modules.iteritems():
+        for m_id, module in self.vt_modules.items():
             if m_id not in b_connections:
                 queue.append((module, 0))
             # if module.db_id not in f_connections:
@@ -282,7 +283,7 @@ class VTK2VT(object):
             levels[ell].append(m)
             module_levels[m.db_id] = ell
 
-        for level, m_list in sorted(levels.iteritems()):
+        for level, m_list in sorted(levels.items()):
             for i, m in enumerate(m_list):
                 if i >= len(m_list) - 1:
                     continue
@@ -321,7 +322,7 @@ class VTK2VT(object):
         dx = 250.0
         dy = 100.0
         current_y = 0.0
-        for level, m_list in levels.iteritems():
+        for level, m_list in levels.items():
             current_x = - (len(m_list) * dx) / 2.0
             for m in m_list:
                 m.db_location.db_x = current_x
@@ -345,7 +346,7 @@ class VTK2VT(object):
         if found_vtk_cell:
             return (module, function_list)
         else:
-            print >>sys.stderr, "ERROR: cannot find VTKCell for Interactor"
+            print("ERROR: cannot find VTKCell for Interactor", file=sys.stderr)
         return (None, None)
     
     def create_functions(self, module, function_list=None, f_pos=0):
@@ -435,7 +436,7 @@ class VTK2VT(object):
 #                 self.inspector_functions:
             # print >>sys.stderr, '>>', function._name, 'found in getters'
             if not allow_sub:
-                print >>sys.stderr, "ERROR: sub function has getter"
+                print("ERROR: sub function has getter", file=sys.stderr)
             key = (id(function.parent), function._name)
             if key in self.created_modules:
                 p_module = self.created_modules[key]
@@ -462,7 +463,7 @@ class VTK2VT(object):
                             else:
                                 p_module = arg.parent
                     if found_setter and type(p_module) != vtk_module:
-                        print >>sys.stderr, "ERROR: type of p_module incorrect"
+                        print("ERROR: type of p_module incorrect", file=sys.stderr)
                         found_setter = False
                     if found_setter:
                         # print >>sys.stderr, "found", module_name, p_module._name
@@ -739,7 +740,7 @@ class VTK2VT(object):
                         # probably need to order the function calls here
                         # ideally, this would be an abstraction of some sort
                         shared_data = set()
-                        for s_module in self.vtk_modules.itervalues():
+                        for s_module in self.vtk_modules.values():
                             if len(s_module.functions) > 0:
                                 if not s_module._name == 'vtkRenderWindow':
                                     shared_data.add(s_module)
@@ -795,8 +796,7 @@ class VTK2VT(object):
                                 s_function_str = s_function._name
                                 while len(s_function.sub_functions) > 0:
                                     if len(s_function.sub_functions) > 1:
-                                        print >> sys.stderr, \
-                                            "ERROR: too many subfunctions"
+                                        print("ERROR: too many subfunctions", file=sys.stderr)
                                     # FIXME need to do args here, too
                                     s_function_str += '().' + \
                                         s_function.sub_functions[0]._name
@@ -832,7 +832,7 @@ class VTK2VT(object):
                         shared_data.discard(observer_module)
                         shared_data.discard(handler_module)
                         handler_module.SharedData(*shared_data)
-                        handler_module.Handler(urllib.quote(handler_code))
+                        handler_module.Handler(urllib.parse.quote(handler_code))
                         # print >> sys.stderr, "shared_data", shared_data
                         # functions.append(s_data_function)
                         self.create_functions(handler_module)
@@ -882,8 +882,7 @@ class VTK2VT(object):
                         for arg in connections:
                             self.create_connection(arg, function)
                     else:
-                        print >>sys.stderr, \
-                            "ERROR: sub function has connections"
+                        print("ERROR: sub function has connections", file=sys.stderr)
             elif len(parameters) > 0:
                 db_parameters = self.get_parameters(parameters)
                 db_function = DBFunction(id=self.max_function_id,
@@ -899,8 +898,8 @@ class VTK2VT(object):
         def create_port(vtk_module, type, name, other_vtk_module):
             # print >>sys.stderr, 'creating port:', vtk_module._name, name
             if id(vtk_module) not in self.modules:
-                print >>sys.stderr, 'ERROR: cannot create port', \
-                    vtk_module._name, type, name
+                print('ERROR: cannot create port', \
+                    vtk_module._name, type, name, file=sys.stderr)
                 import traceback
                 traceback.print_stack()
                 return (None, None)
@@ -929,8 +928,8 @@ class VTK2VT(object):
             while ps_key not in db_module_desc.db_portSpecs_name_index:
                 base_id = db_module_desc.db_base_descriptor_id
                 if base_id < 0:
-                    print >>sys.stderr, 'ERROR: cannot create port', \
-                        vtk_module._name, type, name
+                    print('ERROR: cannot create port', \
+                        vtk_module._name, type, name, file=sys.stderr)
                     import traceback
                     traceback.print_stack()
                     return (None, None)
@@ -972,8 +971,7 @@ class VTK2VT(object):
                 (found_module, _) = self.find_or_create_module(entity.parent)
                 port_name = entity._name
                 if not found_module:
-                    print >>sys.stderr, \
-                        "ERROR: cannot convert function", entity._name
+                    print("ERROR: cannot convert function", entity._name, file=sys.stderr)
                     
 #             elif type(entity) == vtk_function:
 #                 found_module = self.find_or_create_module(entity)
@@ -990,8 +988,8 @@ class VTK2VT(object):
 #                         found_module = entity.parent
 #                         port_name = entity._name
             else:
-                print >>sys.stderr, 'ERROR: cannot deal with type "' + \
-                    str(type(entity))
+                print('ERROR: cannot deal with type "' + \
+                    str(type(entity)), file=sys.stderr)
                 found_module = None
                 port_name = None
             return (found_module, port_name)
@@ -1051,8 +1049,8 @@ class VTK2VT(object):
 #                 str(type(dst)) + '"'
 
         if not src_module or not dst_module:
-            print >>sys.stderr, 'ERROR: cannot create connection', \
-                src._name, dst._name
+            print('ERROR: cannot create connection', \
+                src._name, dst._name, file=sys.stderr)
             return None
 #         print >>sys.stderr, 'creating connection:', \
 #             src_module.db_name, dst_module.db_name
@@ -1079,10 +1077,10 @@ class VTK2VT(object):
         import vistrails.db.services.action
 
         action_list = []
-        for module in self.modules.itervalues():
+        for module in self.modules.values():
             # print 'module:', module._name, id(module)
             action_list.append(('add', module))
-        for connection_list in self.connections.itervalues():
+        for connection_list in self.connections.values():
             for connection in connection_list:
                 # print 'connection:', connection._name, id(connection)
                 action_list.append(('add', connection))
@@ -1093,7 +1091,7 @@ class VTK2VT(object):
         action.db_user = 'dakoop'
         action.db_date = datetime.datetime.now()
 
-        tag = DBTag(name='Auto-Translated', id=1L)
+        tag = DBTag(name='Auto-Translated', id=1)
             
         op_id = 0
         for op in action.db_operations:
@@ -1114,5 +1112,5 @@ class VTK2VT(object):
             vistrails.db.services.io.save_bundle_to_zip_xml(SaveBundle(DBVistrail.vtType, vistrail), filename)
         else:
             f = None
-            print >>f, vistrails.db.services.io.serialize(vistrail)
+            print(vistrails.db.services.io.serialize(vistrail), file=f)
             
Index: vistrails-3.0~git+9dc22bd/scripts/get_usersguide.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/get_usersguide.py
+++ vistrails-3.0~git+9dc22bd/scripts/get_usersguide.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -38,7 +38,7 @@
 import os.path
 import subprocess
 import sys
-import urllib2
+import urllib.request, urllib.error, urllib.parse
 
 this_dir = os.path.dirname(os.path.abspath(__file__))
 
@@ -65,8 +65,8 @@ def which(program):
     return None
 
 def download_usersguide():
-    print "Downloading usersguide from", DOWNLOAD_URL
-    response = urllib2.urlopen(DOWNLOAD_URL)
+    print("Downloading usersguide from", DOWNLOAD_URL)
+    response = urllib.request.urlopen(DOWNLOAD_URL)
     filename = os.path.join(SAVE_TO,
                             DOWNLOAD_URL.split('/')[-1])
     f = open(filename, 'wb')
@@ -75,10 +75,10 @@ def download_usersguide():
     
 if __name__ == "__main__":
     if which('sphinx-build') is None:
-        print "Sphinx is not installed!"
+        print("Sphinx is not installed!")
         download_usersguide()
     elif which('pdflatex') is None:
-        print "pdflatex is not installed!"
+        print("pdflatex is not installed!")
         download_usersguide()
     else:
         cwd = os.getcwd()
@@ -90,9 +90,9 @@ if __name__ == "__main__":
                                 stderr=subprocess.STDOUT)
         proc.wait()
         if proc.returncode != 0:
-            print "ERROR: building usersguide failed."
+            print("ERROR: building usersguide failed.")
             if proc.stdout:
-                print proc.stdout.readlines()        
+                print(proc.stdout.readlines())        
             sys.exit(1)
         os.chdir(this_dir)
 
Index: vistrails-3.0~git+9dc22bd/scripts/merge_vistrails.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/merge_vistrails.py
+++ vistrails-3.0~git+9dc22bd/scripts/merge_vistrails.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -61,7 +61,7 @@ def main(out_fname, in_fnames):
     
 if __name__ == '__main__':
     if len(sys.argv) < 3:
-        print "Usage: %s [output filename] [list of input vistrails]" % \
-            sys.argv[0]
+        print("Usage: %s [output filename] [list of input vistrails]" % \
+            sys.argv[0])
         sys.exit(0)
     main(sys.argv[1], sys.argv[2:])
Index: vistrails-3.0~git+9dc22bd/scripts/opm/opm2dot.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/opm/opm2dot.py
+++ vistrails-3.0~git+9dc22bd/scripts/opm/opm2dot.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -53,8 +53,8 @@ def run(filename, account=None):
                     return True
         return False
         
-    print 'digraph {'
-    print 'edge [dir = "back", style="dashed"];'
+    print('digraph {')
+    print('edge [dir = "back", style="dashed"];')
     for process in root.getiterator('processes').next().getiterator('process'):
         if not should_include(process):
             continue
@@ -75,13 +75,13 @@ def run(filename, account=None):
             shape = 'hexagon'
         else:
             shape = 'box'
-        print '%d [label="%s", shape=%s, color=blue];' % \
-            (node_id, process_label, shape)
+        print('%d [label="%s", shape=%s, color=blue];' % \
+            (node_id, process_label, shape))
         lookup[process_id] = node_id
         node_id += 1
         if error is not None:
-            print '%d [label="ERROR: %s", shape=octagon, color=black];' % (node_id,
-                                                                    error)
+            print('%d [label="ERROR: %s", shape=octagon, color=black];' % (node_id,
+                                                                    error))
             error_edges.append((node_id - 1, node_id))
         node_id += 1
 
@@ -106,7 +106,7 @@ def run(filename, account=None):
                     if len(param_val) > 32:
                         if param.get('type') == \
                                 'edu.utah.sci.vistrails.basic:File':
-                            print >>sys.stderr, "got here"
+                            print("got here", file=sys.stderr)
                             dir_names = []
                             dir_name = param_val
                             while os.path.split(dir_name)[1]:
@@ -126,19 +126,18 @@ def run(filename, account=None):
                                     else:
                                         j += 1
                                 dir_names[-1] = '_'.join(arr[:i] + ['...'] + arr[-j:])
-                            print >>sys.stderr, dir_names
+                            print(dir_names, file=sys.stderr)
                             i = 1
                             while (len(os.path.join(dir_names[0], dir_names[1],
                                                     '...', 
                                                     *dir_names[-i:])) < 32 and
                                    i+1 < len(dir_names)):
-                                print >>sys.stderr, \
-                                    len(os.path.join(dir_names[0], 
+                                print(len(os.path.join(dir_names[0], 
                                                      dir_names[1],
                                                      '...', 
-                                                     *dir_names[-i:]))
+                                                     *dir_names[-i:])), file=sys.stderr)
                                 i += 1
-                            print >>sys.stderr, i
+                            print(i, file=sys.stderr)
                             param_val = os.path.join(dir_names[0], 
                                                      dir_names[1], '...',
                                                      *dir_names[-i:])
@@ -148,40 +147,40 @@ def run(filename, account=None):
                     comma = ', '
                 artifact_label += ')'
             else:
-                print >>sys.stderr, "ERROR:", child.tag
+                print("ERROR:", child.tag, file=sys.stderr)
                 artifact_label = artifact.get('id')
-        print '%d [label="%s", color=red];' % (node_id, artifact_label)
+        print('%d [label="%s", color=red];' % (node_id, artifact_label))
         lookup[artifact_id] = node_id
         node_id += 1
     for used in root.getiterator('causalDependencies').next().getiterator('used'):
         if not should_include(used):
             continue
 
-        print "%d -> %d;" % \
+        print("%d -> %d;" % \
             (lookup[used.getiterator('cause').next().get('id')], 
-             lookup[used.getiterator('effect').next().get('id')])
+             lookup[used.getiterator('effect').next().get('id')]))
     for wgb in root.getiterator('causalDependencies').next().getiterator('wasGeneratedBy'):
         if not should_include(wgb):
             continue
 
-        print "%d -> %d;" % \
+        print("%d -> %d;" % \
             (lookup[wgb.getiterator('cause').next().get('id')], 
-             lookup[wgb.getiterator('effect').next().get('id')])
+             lookup[wgb.getiterator('effect').next().get('id')]))
     for wtb in root.getiterator('causalDependencies').next().getiterator('wasTriggeredBy'):
         if not should_include(wtb):
             continue
-        print "%d -> %d;" % \
+        print("%d -> %d;" % \
             (lookup[wtb.getiterator('cause').next().get('id')], 
-             lookup[wtb.getiterator('effect').next().get('id')])
+             lookup[wtb.getiterator('effect').next().get('id')]))
 
     for error_edge in error_edges:
-        print "%d -> %d;" % error_edge
-    print "}"
+        print("%d -> %d;" % error_edge)
+    print("}")
     
 
 if __name__ == '__main__':
     if len(sys.argv) < 2:
-        print "Usage: python %s <opm_file> [account]" % sys.argv[0]
+        print("Usage: python %s <opm_file> [account]" % sys.argv[0])
         sys.exit(42)
     account = sys.argv[2] if len(sys.argv) > 2 else None
     run(sys.argv[1], account)
Index: vistrails-3.0~git+9dc22bd/scripts/release_notes.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/release_notes.py
+++ vistrails-3.0~git+9dc22bd/scripts/release_notes.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -39,7 +39,7 @@ tickets. Use the configuration section b
 The text will be written to the standard output.
 """
 
-import xmlrpclib
+import xmlrpc.client
 import git
 import getpass
 import os
@@ -74,9 +74,9 @@ def userpass(realm, u, may_save):
     global username
     global password
     if not username:
-        print "Username:",
+        print("Username:", end=' ')
         sys.stdout.flush()
-        username = raw_input()
+        username = input()
         password = getpass.getpass()
     return True, username, password, False
 
@@ -91,17 +91,17 @@ def clone_vistrails_git_repository(path_
     global cloneremote
     cmdlist = ['git', 'clone', cloneremote,
                path_to]
-    print "Cloning vistrails from:"
-    print "  %s to"%cloneremote
-    print "  %s"%path_to
-    print "Be patient. This may take a while."
+    print("Cloning vistrails from:")
+    print("  %s to"%cloneremote)
+    print("  %s"%path_to)
+    print("Be patient. This may take a while.")
     process = subprocess.Popen(cmdlist, shell=False,
                                stdin=subprocess.PIPE,
                                stdout=subprocess.PIPE,
                                stderr=subprocess.STDOUT)
     process.wait()
     if process.returncode == 0:
-        print "repository is cloned."
+        print("repository is cloned.")
     return process.returncode
 
 ################################################################################
@@ -116,9 +116,9 @@ def init_repo():
                 ok = True
                 init_branch(clonepath,branch)
             need_cleanup = True
-        except Exception, e:
-            print "ERROR: Could not clone vistrails repository!"
-            print str(e)
+        except Exception as e:
+            print("ERROR: Could not clone vistrails repository!")
+            print(str(e))
             shutil.rmtree(clonepath)
             sys.exit(1)
     else:
@@ -129,7 +129,7 @@ def init_repo():
         repo = git.Repo(clonepath)
         return repo
     else:
-        print "ERROR: git clone failed."
+        print("ERROR: git clone failed.")
         sys.exit(1)
 
 ################################################################################
@@ -143,7 +143,7 @@ def cleanup_repo():
 
 def init_branch(path_to, branch):
     cmdlist = ['git', 'checkout', "%s"%branch]
-    print "Checking out %s branch..."%branch
+    print("Checking out %s branch..."%branch)
     current_dir = os.getcwd()
     os.chdir(path_to)
     process = subprocess.Popen(cmdlist, shell=False,
@@ -153,9 +153,9 @@ def init_branch(path_to, branch):
     process.wait()
     lines = process.stdout.readlines()
     for line in lines:
-        print "   ", line
+        print("   ", line)
     if process.returncode == 0:
-        print "Branch %s was checked out."%branch
+        print("Branch %s was checked out."%branch)
     os.chdir(current_dir)
     return process.returncode
 
@@ -163,7 +163,7 @@ def init_branch(path_to, branch):
 
 def pull_changes(path_to):
     cmdlist = ['git', 'pull']
-    print "Pulling changes into the branch..."
+    print("Pulling changes into the branch...")
     current_dir = os.getcwd()
     os.chdir(path_to)
     process = subprocess.Popen(cmdlist, shell=False,
@@ -173,9 +173,9 @@ def pull_changes(path_to):
     process.wait()
     lines = process.stdout.readlines()
     for line in lines:
-        print "   ", line
+        print("   ", line)
     if process.returncode == 0:
-        print "Changes were pulled."
+        print("Changes were pulled.")
     os.chdir(current_dir)
     return process.returncode
 
@@ -253,29 +253,29 @@ def build_release_notes(repo, branch):
 
 
     #get ticket summaries from xmlrpc plugin installed on vistrails trac
-    print "Will connect to VisTrails Trac with authentication..."
+    print("Will connect to VisTrails Trac with authentication...")
     if not username:
-        print "Username:",
+        print("Username:", end=' ')
         sys.stdout.flush()
-        username = raw_input()
+        username = input()
         password = getpass.getpass()
 
     url = "https://%s:%s@www.vistrails.org/login/xmlrpc"%(username,
                                                                password)
-    server = xmlrpclib.ServerProxy(url)
-    print "downloading tickets.",
-    for (tid,r) in tickets.items():
-        print ".",
+    server = xmlrpc.client.ServerProxy(url)
+    print("downloading tickets.", end=' ')
+    for (tid,r) in list(tickets.items()):
+        print(".", end=' ')
         sys.stdout.flush()
         try:
             ticket_info[tid] = server.ticket.get(tid)
-        except Exception, e:
+        except Exception as e:
             del tickets[tid]
-            print "commit %s: Could not get info for ticket %s"%(r,tid)
-    print "done."
+            print("commit %s: Could not get info for ticket %s"%(r,tid))
+    print("done.")
 
     #place tickets on bugfixes or enhancements
-    for (tid,r) in tickets.iteritems():
+    for (tid,r) in tickets.items():
         txt = "Ticket %s: %s"%(tid,ticket_info[tid][3]['summary'])
         if ticket_info[tid][3]['type'] == 'enhancement':
             features[txt] = r
@@ -287,43 +287,43 @@ def build_release_notes(repo, branch):
     if commit_end == "HEAD" and len(logs) > 0:
         commit_end = logs[0].hexsha
 
-    print
-    print
-    print "Release Name: v%s build %s from %s branch" % (release_name,
+    print()
+    print()
+    print("Release Name: v%s build %s from %s branch" % (release_name,
                                                          commit_end[0:12],
-                                                         branch)
-    print
-    print "Enhancements:"
+                                                         branch))
+    print()
+    print("Enhancements:")
     times = []
-    for t, r in features.iteritems():
+    for t, r in features.items():
         times.append((log_map_time[r], t))
     revisions = sorted(times)
     revisions.reverse()
     for (t,text) in revisions:
         r = features[text]
-        print " - %s (%s)" %(rstrip(text),r[0:12])
+        print(" - %s (%s)" %(rstrip(text),r[0:12]))
 
-    print
-    print "Bug fixes:"
+    print()
+    print("Bug fixes:")
     times = []
-    for t, r in bugfixes.iteritems():
+    for t, r in bugfixes.items():
         times.append((log_map_time[r], t))
     revisions = sorted(times)
     revisions.reverse()
     for (t,text) in revisions:
         r = bugfixes[text]
-        print " - %s (%s)" %(rstrip(text),r[0:12])
+        print(" - %s (%s)" %(rstrip(text),r[0:12]))
 
-    print
-    print "Other changes:"
+    print()
+    print("Other changes:")
     times = []
-    for t, r in changes.iteritems():
+    for t, r in changes.items():
         times.append((log_map_time[r], t))
     revisions = sorted(times)
     revisions.reverse()
     for (t,text) in revisions:
         r = changes[text]
-        print " - %s (%s)" %(text.split('\n')[0][0:100].rstrip(),r[0:12])
+        print(" - %s (%s)" %(text.split('\n')[0][0:100].rstrip(),r[0:12]))
 
 if __name__ == "__main__":
     repo = init_repo()
Index: vistrails-3.0~git+9dc22bd/scripts/build_usersguide.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/build_usersguide.py
+++ vistrails-3.0~git+9dc22bd/scripts/build_usersguide.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -83,7 +83,7 @@ if __name__ == '__main__':
         os.path.exists(PATH_TO_VISTRAILS_GIT)):
         current_folder = os.getcwd()
         if PERFORM_GIT_PULL:
-            print "performing git pull in %s..."%PATH_TO_VISTRAILS_GIT
+            print("performing git pull in %s..."%PATH_TO_VISTRAILS_GIT)
             os.chdir(PATH_TO_VISTRAILS_GIT)
             proc = subprocess.Popen(GIT_PULL_CMD,
                                     stdin=subprocess.PIPE,
@@ -91,9 +91,9 @@ if __name__ == '__main__':
                                     stderr=subprocess.STDOUT)
             proc.wait()
             if proc.returncode != 0:
-                print "ERROR: git pull failed."
+                print("ERROR: git pull failed.")
                 if proc.stdout:
-                    print proc.stdout.readlines()
+                    print(proc.stdout.readlines())
         
         # The api needs path to source set
         env = os.environ.copy()
@@ -102,10 +102,10 @@ if __name__ == '__main__':
         os.chdir(os.path.join(PATH_TO_VISTRAILS_GIT,
                               *USERSGUIDE_SUBPATH))
         
-        print "Going into directory %s"%os.getcwd()
+        print("Going into directory %s"%os.getcwd())
         if BUILD_HTML:
             # now build html documentation    
-            print "now building html documentation..."
+            print("now building html documentation...")
             proc = subprocess.Popen(["make", "html"],
                                     stdin=subprocess.PIPE,
                                     stdout=subprocess.PIPE,
@@ -113,9 +113,9 @@ if __name__ == '__main__':
                                     env=env)
             proc.wait()
             if proc.returncode != 0:
-                print "ERROR: make html failed."
+                print("ERROR: make html failed.")
                 if proc.stdout:
-                    print proc.stdout.readlines()
+                    print(proc.stdout.readlines())
             else:
                 # now move files to their final place
                 if HTML_FOLDER is not None:
@@ -126,19 +126,19 @@ if __name__ == '__main__':
                     shutil.move(html_build, HTML_FOLDER)
 
         if BUILD_PDF:
-            print "Building usersguide to ", PDF_FILE
+            print("Building usersguide to ", PDF_FILE)
             #build latex files
-            print "now preparing latex files..."
+            print("now preparing latex files...")
             latex_path = os.path.join(".",
                                   *BUILD_LATEX_SUBPATH)
             if os.path.exists(latex_path):
-                print "removing old %s directory..."%latex_path
+                print("removing old %s directory..."%latex_path)
                 proc = subprocess.Popen(["rm", "-rf", latex_path],
                                         stdin=subprocess.PIPE,
                                         stdout=subprocess.PIPE,
                                         stderr=subprocess.STDOUT)
                 proc.wait()
-            print "building latex files..."
+            print("building latex files...")
             proc = subprocess.Popen(["make", "latex"],
                                     stdin=subprocess.PIPE,
                                     stdout=subprocess.PIPE,
@@ -146,12 +146,12 @@ if __name__ == '__main__':
                                     env=env)
             proc.wait()
             if proc.returncode != 0:
-                print "ERROR: make latex failed."
+                print("ERROR: make latex failed.")
                 if proc.stdout:
-                    print proc.stdout.readlines()
+                    print(proc.stdout.readlines())
             else:
                 #now build pdf
-                print "now building pdf file..."
+                print("now building pdf file...")
                 os.chdir(os.path.join(os.getcwd(),
                          *BUILD_LATEX_SUBPATH))
                 proc = subprocess.Popen(["make", "LATEXOPTS=-interaction=nonstopmode -halt-on-error", "all-pdf"],
@@ -161,8 +161,8 @@ if __name__ == '__main__':
                                     env=env)
                 output, error = proc.communicate()
                 if proc.returncode != 0:
-                    print "ERROR: make all-pdf failed."
-                    print output, error
+                    print("ERROR: make all-pdf failed.")
+                    print(output, error)
                 else:
                     #now move file to its final place
                     if PDF_FILE is not None:
@@ -172,6 +172,6 @@ if __name__ == '__main__':
                                                  PDF_BUILD_NAME)
                         shutil.move(pdf_build, PDF_FILE)
         os.chdir(current_folder)
-        print "Done."
+        print("Done.")
     else:
-        print "PATH_TO_VISTRAILS_GIT was not provided. Exiting."
+        print("PATH_TO_VISTRAILS_GIT was not provided. Exiting.")
Index: vistrails-3.0~git+9dc22bd/scripts/extract.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/extract.py
+++ vistrails-3.0~git+9dc22bd/scripts/extract.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -54,7 +54,7 @@ def copy_dir(src, dst):
 
 if __name__ == "__main__":
     if len(sys.argv) != 2:
-        print "Usage: python extract.py resource_rc"
+        print("Usage: python extract.py resource_rc")
         sys.exit(0)
 
     module_name = sys.argv[1]
Index: vistrails-3.0~git+9dc22bd/vistrails/vistrails_server.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/vistrails/vistrails_server.py
+++ vistrails-3.0~git+9dc22bd/vistrails/vistrails_server.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
@@ -80,12 +80,12 @@ if __name__ == '__main__':
                                                           args=sys.argv[1:])
         app = vistrails.gui.application_server.VistrailsServer()
     except SystemExit as e:
-        print(str(e))
+        print((str(e)))
         sys.exit(e)
     except Exception as e:
         import traceback
-        print("Uncaught exception on initialization: %s" % (
-                traceback._format_final_exc_line(type(e).__name__, e)))
+        print(("Uncaught exception on initialization: %s" % (
+                traceback._format_final_exc_line(type(e).__name__, e))))
         traceback.print_exc()
         sys.exit(255)
      
Index: vistrails-3.0~git+9dc22bd/scripts/add_future_import.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/add_future_import.py
+++ vistrails-3.0~git+9dc22bd/scripts/add_future_import.py
@@ -1,5 +1,5 @@
-#!/usr/bin/env python
-from __future__ import absolute_import, unicode_literals
+#!/usr/bin/python3
+
 
 import argparse
 import logging
Index: vistrails-3.0~git+9dc22bd/scripts/delete_from_db.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/delete_from_db.py
+++ vistrails-3.0~git+9dc22bd/scripts/delete_from_db.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
Index: vistrails-3.0~git+9dc22bd/scripts/dist/common/set_version.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/dist/common/set_version.py
+++ vistrails-3.0~git+9dc22bd/scripts/dist/common/set_version.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
Index: vistrails-3.0~git+9dc22bd/scripts/force_start_vistrails_nonohup.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/force_start_vistrails_nonohup.py
+++ vistrails-3.0~git+9dc22bd/scripts/force_start_vistrails_nonohup.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
Index: vistrails-3.0~git+9dc22bd/scripts/force_start_vistrails.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/force_start_vistrails.py
+++ vistrails-3.0~git+9dc22bd/scripts/force_start_vistrails.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
Index: vistrails-3.0~git+9dc22bd/scripts/generate_pkg_doc.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/generate_pkg_doc.py
+++ vistrails-3.0~git+9dc22bd/scripts/generate_pkg_doc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 
 import itertools
 import sys
@@ -17,14 +17,14 @@ def trim_docstring(docstring):
     # and split into a list of lines:
     lines = docstring.expandtabs().splitlines()
     # Determine minimum indentation (first line doesn't count):
-    indent = sys.maxint
+    indent = sys.maxsize
     for line in lines[1:]:
         stripped = line.lstrip()
         if stripped:
             indent = min(indent, len(line) - len(stripped))
     # Remove indentation (first line is special):
     trimmed = [lines[0].strip()]
-    if indent < sys.maxint:
+    if indent < sys.maxsize:
         for line in lines[1:]:
             trimmed.append(line[indent:].rstrip())
     # Strip off trailing and leading blank lines:
@@ -49,61 +49,61 @@ def get_examples(desc):
 
 def generate_module_doc(desc, f=None, depth=1, inherited=True):
     reg = get_module_registry()
-    print >>f, desc.name
-    print >>f, heading_order[depth] * len(desc.name)
-    print >>f, ""
-    print >>f, ".. py:class:: %s" % desc.name
-    print >>f, ""
+    print(desc.name, file=f)
+    print(heading_order[depth] * len(desc.name), file=f)
+    print("", file=f)
+    print(".. py:class:: %s" % desc.name, file=f)
+    print("", file=f)
     if desc.module.__doc__:
-        print >>f, format_docstring(desc.module.__doc__, 2)
-        print >>f, ""
+        print(format_docstring(desc.module.__doc__, 2), file=f)
+        print("", file=f)
 
     if inherited:
         input_ports = reg.module_destination_ports_from_descriptor(True, desc)
         output_ports = reg.module_source_ports_from_descriptor(True, desc)
     else:
-        input_ports = reg.module_ports('input', desc).values()
+        input_ports = list(reg.module_ports('input', desc).values())
         input_ports.sort(key=lambda x: (x.sort_key, x.id))
-        output_ports = reg.module_ports('output', desc).values()
+        output_ports = list(reg.module_ports('output', desc).values())
         output_ports.sort(key=lambda x: (x.sort_key, x.id))
         
     if len(input_ports) > 0:
-        print >>f, "  *Input Ports*"
+        print("  *Input Ports*", file=f)
         for port in input_ports:
             sigstring = port.sigstring.replace(':', '.')[1:-1]
-            print >>f, "    .. py:attribute:: %s" % port.name
-            print >>f, ""            
-            print >>f, "      | *Signature*: :py:class:`%s`" % sigstring
+            print("    .. py:attribute:: %s" % port.name, file=f)
+            print("", file=f)            
+            print("      | *Signature*: :py:class:`%s`" % sigstring, file=f)
             if port.docstring():
-                print >>f, "      | *Description*: %s" % format_docstring(port.docstring(), 9)
-            print >>f, ""
+                print("      | *Description*: %s" % format_docstring(port.docstring(), 9), file=f)
+            print("", file=f)
     if len(output_ports) > 0:
-        print >>f, "  *Output Ports*"
+        print("  *Output Ports*", file=f)
         for port in output_ports:
             sigstring = port.sigstring.replace(':', '.')[1:-1]
-            print >>f, "    .. py:attribute:: %s" % port.name
-            print >>f, ""            
-            print >>f, "      | *Signature*: :py:class:`%s`" % sigstring
+            print("    .. py:attribute:: %s" % port.name, file=f)
+            print("", file=f)            
+            print("      | *Signature*: :py:class:`%s`" % sigstring, file=f)
             if port.docstring():
-                print >>f, "      | *Description*: %s" % format_docstring(port.docstring(), 9)
-            print >>f, ""
+                print("      | *Description*: %s" % format_docstring(port.docstring(), 9), file=f)
+            print("", file=f)
 
     examples = get_examples(desc)
     if len(examples) > 0:
-        print >>f, "  *Examples*"
+        print("  *Examples*", file=f)
         for example in examples:
-            print >>f, "   * %s" % example
-        print >>f, ""
+            print("   * %s" % example, file=f)
+        print("", file=f)
 
 def generate_docs(pkg, namespace=None, f=None):
-    print >>f, pkg._package.name
-    print >>f, heading_order[0] * len(pkg._package.name)
-    print >>f, ""
-    print >>f, ".. py:module:: %s\n" % pkg._package.identifier
-    print >>f, '| *Identifier*: %s' % pkg._package.identifier
-    print >>f, '| *Version*: %s\n' % pkg._package.version
-    print >>f, format_docstring(pkg._package.description, 0)
-    print >>f, ""
+    print(pkg._package.name, file=f)
+    print(heading_order[0] * len(pkg._package.name), file=f)
+    print("", file=f)
+    print(".. py:module:: %s\n" % pkg._package.identifier, file=f)
+    print('| *Identifier*: %s' % pkg._package.identifier, file=f)
+    print('| *Version*: %s\n' % pkg._package.version, file=f)
+    print(format_docstring(pkg._package.description, 0), file=f)
+    print("", file=f)
     
     if namespace == '':
         for desc in pkg._namespaces[1]:
@@ -114,27 +114,27 @@ def generate_docs(pkg, namespace=None, f
             for desc in pkg._namespaces[1]:
                 generate_module_doc(desc, f)
             namespaces = sorted(item + (1,) for item in 
-                                pkg._namespaces[0].iteritems())
+                                pkg._namespaces[0].items())
         else:
             namespace_dict = pkg._namespaces[0]
             descs = pkg._namespaces[1]
             split_ns = namespace.split('|')
             for i, ns in enumerate(split_ns):
-                print >>f, ns
-                print >>f, heading_order[i+1] * len(ns)
-                print >>f, ""
+                print(ns, file=f)
+                print(heading_order[i+1] * len(ns), file=f)
+                print("", file=f)
                 (namespace_dict, descs) = namespace_dict[ns]
             namespaces = [(namespace, (namespace_dict, descs), len(split_ns))]
         
         for (ns, (child_namespaces, descs), depth) in namespaces:
-            print >>f, ns
-            print >>f, heading_order[depth] * len(ns)
-            print >>f, ""
+            print(ns, file=f)
+            print(heading_order[depth] * len(ns), file=f)
+            print("", file=f)
             for desc in descs:
                 generate_module_doc(desc, f, depth+1)
             namespaces = \
                 itertools.chain([(ns + '|' + c[0], c[1]) 
-                                 for c in child_namespaces.iteritems()],
+                                 for c in child_namespaces.items()],
                                 namespaces, depth+1)
 
 def run():
Index: vistrails-3.0~git+9dc22bd/scripts/module_appearance/main.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/module_appearance/main.py
+++ vistrails-3.0~git+9dc22bd/scripts/module_appearance/main.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
Index: vistrails-3.0~git+9dc22bd/scripts/update_vistrails_command.py
===================================================================
--- vistrails-3.0~git+9dc22bd.orig/scripts/update_vistrails_command.py
+++ vistrails-3.0~git+9dc22bd/scripts/update_vistrails_command.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python3
 ###############################################################################
 ##
 ## Copyright (C) 2014-2016, New York University.
