Kill execfile(), use exec() instead
diff --git a/Mac/Modules/ae/aescan.py b/Mac/Modules/ae/aescan.py
index 1283c1d..0ea367c 100644
--- a/Mac/Modules/ae/aescan.py
+++ b/Mac/Modules/ae/aescan.py
@@ -21,7 +21,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done Scanning and Generating, now doing 'import aesupport' ==="
     import aesupport
     print "=== Done 'import aesupport'.  It's up to you to compile AEmodule.c ==="
diff --git a/Mac/Modules/ae/aesupport.py b/Mac/Modules/ae/aesupport.py
index 91c5b82..d3e1dfd 100644
--- a/Mac/Modules/ae/aesupport.py
+++ b/Mac/Modules/ae/aesupport.py
@@ -213,8 +213,8 @@
 functions = []
 aedescmethods = []
 
-execfile('aegen.py')
-##execfile('aedatamodelgen.py')
+exec(open('aegen.py').read())
+##exec(open('aedatamodelgen.py').read())
 
 # Manual generator
 AutoDispose_body = """
diff --git a/Mac/Modules/ah/ahscan.py b/Mac/Modules/ah/ahscan.py
index 0b7fe08..8768b60 100644
--- a/Mac/Modules/ah/ahscan.py
+++ b/Mac/Modules/ah/ahscan.py
@@ -18,7 +18,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/ah/ahsupport.py b/Mac/Modules/ah/ahsupport.py
index c5f24be..9fa9dde 100644
--- a/Mac/Modules/ah/ahsupport.py
+++ b/Mac/Modules/ah/ahsupport.py
@@ -34,7 +34,7 @@
 
 # Create and populate the lists
 functions = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/app/appscan.py b/Mac/Modules/app/appscan.py
index 1b04859..246d61e 100644
--- a/Mac/Modules/app/appscan.py
+++ b/Mac/Modules/app/appscan.py
@@ -18,7 +18,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/app/appsupport.py b/Mac/Modules/app/appsupport.py
index 177dfd5..73f5f11 100644
--- a/Mac/Modules/app/appsupport.py
+++ b/Mac/Modules/app/appsupport.py
@@ -121,7 +121,7 @@
 # Create and populate the lists
 functions = []
 methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/carbonevt/CarbonEvtscan.py b/Mac/Modules/carbonevt/CarbonEvtscan.py
index e3c72ae..7307327 100644
--- a/Mac/Modules/carbonevt/CarbonEvtscan.py
+++ b/Mac/Modules/carbonevt/CarbonEvtscan.py
@@ -20,7 +20,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "--done scanning, importing--"
     import CarbonEvtsupport
     print "done"
diff --git a/Mac/Modules/carbonevt/CarbonEvtsupport.py b/Mac/Modules/carbonevt/CarbonEvtsupport.py
index 77d12b6..2adc8cb 100644
--- a/Mac/Modules/carbonevt/CarbonEvtsupport.py
+++ b/Mac/Modules/carbonevt/CarbonEvtsupport.py
@@ -214,7 +214,7 @@
     execstr = typ + 'methods = []'
     exec execstr
 
-execfile('CarbonEventsgen.py')
+exec(open('CarbonEventsgen.py').read())
 
 
 
diff --git a/Mac/Modules/cf/cfscan.py b/Mac/Modules/cf/cfscan.py
index d2de92e..5ff9534 100644
--- a/Mac/Modules/cf/cfscan.py
+++ b/Mac/Modules/cf/cfscan.py
@@ -45,7 +45,7 @@
     scanner.gentypetest(SHORT+"typetest.py")
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/cf/cfsupport.py b/Mac/Modules/cf/cfsupport.py
index 800581a..655331e 100644
--- a/Mac/Modules/cf/cfsupport.py
+++ b/Mac/Modules/cf/cfsupport.py
@@ -529,7 +529,7 @@
 CFURLRef_methods = []
 
 # ADD _methods initializer here
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 
 # add the populated lists to the generator groups
diff --git a/Mac/Modules/cg/cgscan.py b/Mac/Modules/cg/cgscan.py
index b2e7946..82f4919 100755
--- a/Mac/Modules/cg/cgscan.py
+++ b/Mac/Modules/cg/cgscan.py
@@ -23,7 +23,7 @@
     scanner.gentypetest(SHORT+"typetest.py")
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/cg/cgsupport.py b/Mac/Modules/cg/cgsupport.py
index 6eedfbe..7fa06e2 100755
--- a/Mac/Modules/cg/cgsupport.py
+++ b/Mac/Modules/cg/cgsupport.py
@@ -145,7 +145,7 @@
 CGContextRef_methods = []
 
 # ADD _methods initializer here
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # manual method, lives in Quickdraw.h
 f = Method(void, 'SyncCGContextOriginWithPort',
diff --git a/Mac/Modules/cm/cmscan.py b/Mac/Modules/cm/cmscan.py
index 087f239..1a1e46d 100644
--- a/Mac/Modules/cm/cmscan.py
+++ b/Mac/Modules/cm/cmscan.py
@@ -17,7 +17,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/cm/cmsupport.py b/Mac/Modules/cm/cmsupport.py
index 4109dba..1653bb3 100644
--- a/Mac/Modules/cm/cmsupport.py
+++ b/Mac/Modules/cm/cmsupport.py
@@ -112,7 +112,7 @@
 functions = []
 c_methods = []
 ci_methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/ctl/ctlscan.py b/Mac/Modules/ctl/ctlscan.py
index 25333f1..dd74d23 100644
--- a/Mac/Modules/ctl/ctlscan.py
+++ b/Mac/Modules/ctl/ctlscan.py
@@ -15,7 +15,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now doing 'import ctlsupport' ==="
     import ctlsupport
     print "=== Done.  It's up to you to compile Ctlmodule.c ==="
diff --git a/Mac/Modules/ctl/ctlsupport.py b/Mac/Modules/ctl/ctlsupport.py
index d354d94..04fac8b 100644
--- a/Mac/Modules/ctl/ctlsupport.py
+++ b/Mac/Modules/ctl/ctlsupport.py
@@ -507,8 +507,8 @@
 # Create and populate the lists
 functions = []
 methods = []
-execfile(INPUTFILE)
-execfile('ctledit.py')
+exec(open(INPUTFILE).read())
+exec(open('ctledit.py').read())
 
 # add the populated lists to the generator groups
 for f in functions: module.add(f)
diff --git a/Mac/Modules/dlg/dlgscan.py b/Mac/Modules/dlg/dlgscan.py
index 7fb68f7..bf37129 100644
--- a/Mac/Modules/dlg/dlgscan.py
+++ b/Mac/Modules/dlg/dlgscan.py
@@ -19,7 +19,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/dlg/dlgsupport.py b/Mac/Modules/dlg/dlgsupport.py
index fa1442e..fcff5c0 100644
--- a/Mac/Modules/dlg/dlgsupport.py
+++ b/Mac/Modules/dlg/dlgsupport.py
@@ -240,7 +240,7 @@
 # Create and populate the lists
 functions = []
 methods = []
-execfile("dlggen.py")
+exec(open("dlggen.py").read())
 
 # add the populated lists to the generator groups
 for f in functions: module.add(f)
diff --git a/Mac/Modules/drag/dragscan.py b/Mac/Modules/drag/dragscan.py
index 923a56b..e89897a 100644
--- a/Mac/Modules/drag/dragscan.py
+++ b/Mac/Modules/drag/dragscan.py
@@ -26,7 +26,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now doing 'import dragsupport' ==="
     import dragsupport
     print "=== Done.  It's up to you to compile Dragmodule.c ==="
diff --git a/Mac/Modules/drag/dragsupport.py b/Mac/Modules/drag/dragsupport.py
index 45838ef..bb1a918 100644
--- a/Mac/Modules/drag/dragsupport.py
+++ b/Mac/Modules/drag/dragsupport.py
@@ -216,7 +216,7 @@
 # Create and populate the lists
 functions = []
 methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 for f in functions: module.add(f)
diff --git a/Mac/Modules/evt/evtscan.py b/Mac/Modules/evt/evtscan.py
index 0d0c9ec..0adce8b 100644
--- a/Mac/Modules/evt/evtscan.py
+++ b/Mac/Modules/evt/evtscan.py
@@ -18,7 +18,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/evt/evtsupport.py b/Mac/Modules/evt/evtsupport.py
index f58da14..8deef92 100644
--- a/Mac/Modules/evt/evtsupport.py
+++ b/Mac/Modules/evt/evtsupport.py
@@ -50,7 +50,7 @@
 
 # Create and populate the lists
 functions = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # Move TickCount here, for convenience
 f = Function(UInt32, 'TickCount',
diff --git a/Mac/Modules/file/filescan.py b/Mac/Modules/file/filescan.py
index 8ebc69f..b7c5d12 100644
--- a/Mac/Modules/file/filescan.py
+++ b/Mac/Modules/file/filescan.py
@@ -18,7 +18,7 @@
     scanner.close()
     scanner.gentypetest(SHORT+"typetest.py")
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/file/filesupport.py b/Mac/Modules/file/filesupport.py
index 37aeb50..de45ed4 100644
--- a/Mac/Modules/file/filesupport.py
+++ b/Mac/Modules/file/filesupport.py
@@ -340,7 +340,7 @@
 PyMac_INIT_TOOLBOX_OBJECT_CONVERT(FSRef, PyMac_GetFSRef);
 """
 
-execfile(string.lower(MODPREFIX) + 'typetest.py')
+exec(open(string.lower(MODPREFIX) + 'typetest.py').read())
 
 # Our object types:
 class FSCatalogInfoDefinition(PEP253Mixin, ObjectDefinition):
@@ -806,7 +806,7 @@
 alias_methods = []
 fsref_methods = []
 fsspec_methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # Manual generators:
 FSRefMakePath_body = """
diff --git a/Mac/Modules/fm/fmscan.py b/Mac/Modules/fm/fmscan.py
index 334d5ec..38abcac 100644
--- a/Mac/Modules/fm/fmscan.py
+++ b/Mac/Modules/fm/fmscan.py
@@ -17,7 +17,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/fm/fmsupport.py b/Mac/Modules/fm/fmsupport.py
index e692053..8e2b8b3 100644
--- a/Mac/Modules/fm/fmsupport.py
+++ b/Mac/Modules/fm/fmsupport.py
@@ -70,7 +70,7 @@
 
 # Create and populate the lists
 functions = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/folder/folderscan.py b/Mac/Modules/folder/folderscan.py
index 8c94893..cccb720 100644
--- a/Mac/Modules/folder/folderscan.py
+++ b/Mac/Modules/folder/folderscan.py
@@ -19,7 +19,7 @@
     scanner.close()
     scanner.gentypetest(SHORT+"typetest.py")
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/folder/foldersupport.py b/Mac/Modules/folder/foldersupport.py
index b9b64bf..224b545 100644
--- a/Mac/Modules/folder/foldersupport.py
+++ b/Mac/Modules/folder/foldersupport.py
@@ -33,7 +33,7 @@
 
 """
 
-execfile(string.lower(MODPREFIX) + 'typetest.py')
+exec(open(string.lower(MODPREFIX) + 'typetest.py').read())
 
 # From here on it's basically all boiler plate...
 
@@ -45,7 +45,7 @@
 
 # Create and populate the lists
 functions = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/help/helpscan.py b/Mac/Modules/help/helpscan.py
index 50e0919..fa8dbde 100644
--- a/Mac/Modules/help/helpscan.py
+++ b/Mac/Modules/help/helpscan.py
@@ -18,7 +18,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/help/helpsupport.py b/Mac/Modules/help/helpsupport.py
index 77f5c2e..37117ee 100644
--- a/Mac/Modules/help/helpsupport.py
+++ b/Mac/Modules/help/helpsupport.py
@@ -66,7 +66,7 @@
 # Create and populate the lists
 functions = []
 ##methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/ibcarbon/IBCarbonscan.py b/Mac/Modules/ibcarbon/IBCarbonscan.py
index 84e4f1e..eb7267d 100644
--- a/Mac/Modules/ibcarbon/IBCarbonscan.py
+++ b/Mac/Modules/ibcarbon/IBCarbonscan.py
@@ -18,7 +18,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "--done scanning, importing--"
     import IBCarbonsupport
     print "done"
diff --git a/Mac/Modules/ibcarbon/IBCarbonsupport.py b/Mac/Modules/ibcarbon/IBCarbonsupport.py
index 5f41328..8744b69 100644
--- a/Mac/Modules/ibcarbon/IBCarbonsupport.py
+++ b/Mac/Modules/ibcarbon/IBCarbonsupport.py
@@ -42,7 +42,7 @@
 functions = []
 methods = []
 
-execfile('IBCarbongen.py')
+exec(open('IBCarbongen.py').read())
 
 for f in functions: module.add(f)
 for m in methods: ibnibobject.add(m)
diff --git a/Mac/Modules/icn/icnscan.py b/Mac/Modules/icn/icnscan.py
index bdc3b84..2d20062 100644
--- a/Mac/Modules/icn/icnscan.py
+++ b/Mac/Modules/icn/icnscan.py
@@ -18,7 +18,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/icn/icnsupport.py b/Mac/Modules/icn/icnsupport.py
index 1b15385..e9a8b78 100644
--- a/Mac/Modules/icn/icnsupport.py
+++ b/Mac/Modules/icn/icnsupport.py
@@ -78,7 +78,7 @@
 # Create and populate the lists
 functions = []
 ##methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/launch/launchscan.py b/Mac/Modules/launch/launchscan.py
index 621033b..dd43e37 100644
--- a/Mac/Modules/launch/launchscan.py
+++ b/Mac/Modules/launch/launchscan.py
@@ -19,7 +19,7 @@
     scanner.close()
     scanner.gentypetest(SHORT+"typetest.py")
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/launch/launchsupport.py b/Mac/Modules/launch/launchsupport.py
index 34c2efb..5faf4b3 100644
--- a/Mac/Modules/launch/launchsupport.py
+++ b/Mac/Modules/launch/launchsupport.py
@@ -75,7 +75,7 @@
 """
 
 # From here on it's basically all boiler plate...
-execfile(string.lower(MODPREFIX) + 'typetest.py')
+exec(open(string.lower(MODPREFIX) + 'typetest.py').read())
 
 # Create the generator groups and link them
 module = MacModule(MODNAME, MODPREFIX, includestuff, finalstuff, initstuff)
@@ -89,7 +89,7 @@
 # Create and populate the lists
 functions = []
 ##methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/list/listscan.py b/Mac/Modules/list/listscan.py
index 877f6cb..14e7dca 100644
--- a/Mac/Modules/list/listscan.py
+++ b/Mac/Modules/list/listscan.py
@@ -18,7 +18,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/list/listsupport.py b/Mac/Modules/list/listsupport.py
index 93baede..2e1144a 100644
--- a/Mac/Modules/list/listsupport.py
+++ b/Mac/Modules/list/listsupport.py
@@ -169,7 +169,7 @@
 # Create and populate the lists
 functions = []
 methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # Function to convert any handle to a list and vv.
 ##f = Function(ListHandle, 'as_List', (Handle, 'h', InMode))
diff --git a/Mac/Modules/menu/menuscan.py b/Mac/Modules/menu/menuscan.py
index ae9465e..46afe16 100644
--- a/Mac/Modules/menu/menuscan.py
+++ b/Mac/Modules/menu/menuscan.py
@@ -14,7 +14,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now doing 'import menusupport' ==="
     import menusupport
     print "=== Done.  It's up to you to compile Menumodule.c ==="
diff --git a/Mac/Modules/menu/menusupport.py b/Mac/Modules/menu/menusupport.py
index a04b755..93d489b 100644
--- a/Mac/Modules/menu/menusupport.py
+++ b/Mac/Modules/menu/menusupport.py
@@ -96,8 +96,8 @@
 # Create and populate the lists
 functions = []
 methods = []
-execfile(INPUTFILE)
-execfile(EXTRAFILE)
+exec(open(INPUTFILE).read())
+exec(open(EXTRAFILE).read())
 
 # add the populated lists to the generator groups
 for f in functions: module.add(f)
diff --git a/Mac/Modules/mlte/mltescan.py b/Mac/Modules/mlte/mltescan.py
index adecb4f..9566ad7 100644
--- a/Mac/Modules/mlte/mltescan.py
+++ b/Mac/Modules/mlte/mltescan.py
@@ -20,7 +20,7 @@
     scanner.gentypetest(SHORT+"typetest.py")
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/mlte/mltesupport.py b/Mac/Modules/mlte/mltesupport.py
index 8dcbed5..4adde0d 100644
--- a/Mac/Modules/mlte/mltesupport.py
+++ b/Mac/Modules/mlte/mltesupport.py
@@ -128,7 +128,7 @@
 UniChar = Type("UniChar", "h") # XXXX For now...
 # ADD object type here
 
-execfile("mltetypetest.py")
+exec(open("mltetypetest.py").read())
 
 # Our (opaque) objects
 
@@ -166,7 +166,7 @@
 TXNFontMenuObject_methods = []
 
 # ADD _methods initializer here
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 
 # add the populated lists to the generator groups
diff --git a/Mac/Modules/osa/osascan.py b/Mac/Modules/osa/osascan.py
index fb8196f..8bad4b7 100644
--- a/Mac/Modules/osa/osascan.py
+++ b/Mac/Modules/osa/osascan.py
@@ -18,7 +18,7 @@
     scanner.close()
     scanner.gentypetest(SHORT+"typetest.py")
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/osa/osasupport.py b/Mac/Modules/osa/osasupport.py
index 8369932..3afdf4e 100644
--- a/Mac/Modules/osa/osasupport.py
+++ b/Mac/Modules/osa/osasupport.py
@@ -88,12 +88,12 @@
 Method = OSErrWeakLinkMethodGenerator
 
 # Test which types we are still missing.
-execfile(string.lower(MODPREFIX) + 'typetest.py')
+exec(open(string.lower(MODPREFIX) + 'typetest.py').read())
 
 # Create and populate the lists
 functions = []
 methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/qd/qdscan.py b/Mac/Modules/qd/qdscan.py
index 85a8cdc..c601b0e 100644
--- a/Mac/Modules/qd/qdscan.py
+++ b/Mac/Modules/qd/qdscan.py
@@ -41,7 +41,7 @@
         ofp.close()
 
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     import qdsupport
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py
index d078ac6..28c2595 100644
--- a/Mac/Modules/qd/qdsupport.py
+++ b/Mac/Modules/qd/qdsupport.py
@@ -269,8 +269,8 @@
 gr_methods = []
 bm_methods = []
 #methods = []
-execfile(INPUTFILE)
-execfile(EXTRAFILE)
+exec(open(INPUTFILE).read())
+exec(open(EXTRAFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/qdoffs/qdoffsscan.py b/Mac/Modules/qdoffs/qdoffsscan.py
index d456e00..7e8f316 100644
--- a/Mac/Modules/qdoffs/qdoffsscan.py
+++ b/Mac/Modules/qdoffs/qdoffsscan.py
@@ -14,7 +14,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     import qdoffssupport
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/qdoffs/qdoffssupport.py b/Mac/Modules/qdoffs/qdoffssupport.py
index 1617773..73855a2 100644
--- a/Mac/Modules/qdoffs/qdoffssupport.py
+++ b/Mac/Modules/qdoffs/qdoffssupport.py
@@ -86,7 +86,7 @@
 # Create and populate the lists
 functions = []
 methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # A method to convert a GWorldPtr to a GrafPtr
 f = Method(GrafPtr, 'as_GrafPtr', (GWorldPtr, 'p', InMode))
diff --git a/Mac/Modules/qt/qtscan.py b/Mac/Modules/qt/qtscan.py
index a2dba15..ac56144 100644
--- a/Mac/Modules/qt/qtscan.py
+++ b/Mac/Modules/qt/qtscan.py
@@ -35,7 +35,7 @@
     scanner.close()
     scanner.gentypetest(SHORT+"typetest.py")
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/qt/qtsupport.py b/Mac/Modules/qt/qtsupport.py
index 132c2b4..4d7988f 100644
--- a/Mac/Modules/qt/qtsupport.py
+++ b/Mac/Modules/qt/qtsupport.py
@@ -307,7 +307,7 @@
 module.addobject(SGOutput_object)
 
 # Test which types we are still missing.
-execfile(string.lower(MODPREFIX) + 'typetest.py')
+exec(open(string.lower(MODPREFIX) + 'typetest.py').read())
 
 # Create the generator classes used to populate the lists
 Function = OSErrWeakLinkFunctionGenerator
@@ -323,7 +323,7 @@
 Track_methods = []
 Movie_methods = []
 SGOutput_methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 #
 # Some functions from ImageCompression.h that we need:
diff --git a/Mac/Modules/res/resscan.py b/Mac/Modules/res/resscan.py
index 47a97e4..853fa13 100644
--- a/Mac/Modules/res/resscan.py
+++ b/Mac/Modules/res/resscan.py
@@ -20,7 +20,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now doing 'import ressupport' ==="
     import ressupport
     print "=== Done 'import ressupport'.  It's up to you to compile Resmodule.c ==="
diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py
index 9e42a45..4eed9ec 100644
--- a/Mac/Modules/res/ressupport.py
+++ b/Mac/Modules/res/ressupport.py
@@ -211,8 +211,8 @@
 functions = []
 resmethods = []
 
-execfile('resgen.py')
-execfile('resedit.py')
+exec(open('resgen.py').read())
+exec(open('resedit.py').read())
 
 for f in functions: module.add(f)
 for f in resmethods: resobject.add(f)
diff --git a/Mac/Modules/scrap/scrapscan.py b/Mac/Modules/scrap/scrapscan.py
index 1fc8191..7521fba 100644
--- a/Mac/Modules/scrap/scrapscan.py
+++ b/Mac/Modules/scrap/scrapscan.py
@@ -20,7 +20,7 @@
     scanner.scan()
     scanner.close()
 ##      print "=== Testing definitions output code ==="
-##      execfile(defsoutput, {}, {})
+##      exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/scrap/scrapsupport.py b/Mac/Modules/scrap/scrapsupport.py
index 84a75d2..b4226a5 100644
--- a/Mac/Modules/scrap/scrapsupport.py
+++ b/Mac/Modules/scrap/scrapsupport.py
@@ -63,7 +63,7 @@
 # Create and populate the lists
 functions = []
 methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)
diff --git a/Mac/Modules/snd/sndscan.py b/Mac/Modules/snd/sndscan.py
index c4a8266..bcdd062 100644
--- a/Mac/Modules/snd/sndscan.py
+++ b/Mac/Modules/snd/sndscan.py
@@ -17,7 +17,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now doing 'import sndsupport' ==="
     import sndsupport
     print "=== Done.  It's up to you to compile Sndmodule.c ==="
diff --git a/Mac/Modules/snd/sndsupport.py b/Mac/Modules/snd/sndsupport.py
index cf0fa6c..5c5da54 100644
--- a/Mac/Modules/snd/sndsupport.py
+++ b/Mac/Modules/snd/sndsupport.py
@@ -304,7 +304,7 @@
 
 # populate the lists
 
-execfile('sndgen.py')
+exec(open('sndgen.py').read())
 
 
 # add the functions and methods to the module and object, respectively
diff --git a/Mac/Modules/te/tescan.py b/Mac/Modules/te/tescan.py
index f5b6fff..c0d6e1c 100644
--- a/Mac/Modules/te/tescan.py
+++ b/Mac/Modules/te/tescan.py
@@ -18,7 +18,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     exec "import " + SHORT + "support"
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/te/tesupport.py b/Mac/Modules/te/tesupport.py
index ad6c053..412d5e7 100644
--- a/Mac/Modules/te/tesupport.py
+++ b/Mac/Modules/te/tesupport.py
@@ -198,7 +198,7 @@
 # Create and populate the lists
 functions = []
 methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # Converter from/to handle
 f = Function(TEHandle, 'as_TE', (Handle, 'h', InMode))
diff --git a/Mac/Modules/win/winscan.py b/Mac/Modules/win/winscan.py
index f78935d..8d2cea9 100644
--- a/Mac/Modules/win/winscan.py
+++ b/Mac/Modules/win/winscan.py
@@ -14,7 +14,7 @@
     scanner.scan()
     scanner.close()
     print "=== Testing definitions output code ==="
-    execfile(defsoutput, {}, {})
+    exec(open(defsoutput).read(), {}, {})
     print "=== Done scanning and generating, now importing the generated code... ==="
     import winsupport
     print "=== Done.  It's up to you to compile it now! ==="
diff --git a/Mac/Modules/win/winsupport.py b/Mac/Modules/win/winsupport.py
index 08a0379..2cadbdc 100644
--- a/Mac/Modules/win/winsupport.py
+++ b/Mac/Modules/win/winsupport.py
@@ -191,7 +191,7 @@
 # Create and populate the lists
 functions = []
 methods = []
-execfile(INPUTFILE)
+exec(open(INPUTFILE).read())
 
 # Add manual routines for converting integer WindowPtr's (as returned by
 # various event routines)  and Dialog objects to a WindowObject.
@@ -211,8 +211,8 @@
 
 # And add the routines that access the internal bits of a window struct. They
 # are currently #defined in Windows.h, they will be real routines in Copland
-# (at which time this execfile can go)
-execfile(EDITFILE)
+# (at which time this exec can go)
+exec(open(EDITFILE).read())
 
 # add the populated lists to the generator groups
 # (in a different wordl the scan program would generate this)