[py3k] execfile → exec
authorRémi Cardona <remi.cardona@logilab.fr>
Fri, 18 Sep 2015 18:26:07 +0200
changeset 10615 6c497fe389d2
parent 10614 57dfde80df11
child 10616 f454404733c1
[py3k] execfile → exec
migration.py
web/propertysheet.py
--- a/migration.py	Tue Sep 15 15:33:47 2015 +0200
+++ b/migration.py	Fri Sep 18 18:26:07 2015 +0200
@@ -349,7 +349,9 @@
             else:
                 pyname = splitext(basename(migrscript))[0]
             scriptlocals['__name__'] = pyname
-            execfile(migrscript, scriptlocals)
+            with open(migrscript, 'rb') as fobj:
+                code = compile(fobj.read(), migrscript, 'exec')
+            exec(code, scriptlocals)
             if funcname is not None:
                 try:
                     func = scriptlocals[funcname]
--- a/web/propertysheet.py	Tue Sep 15 15:33:47 2015 +0200
+++ b/web/propertysheet.py	Fri Sep 18 18:26:07 2015 +0200
@@ -57,7 +57,9 @@
     def load(self, fpath):
         scriptglobals = self.context.copy()
         scriptglobals['__file__'] = fpath
-        execfile(fpath, scriptglobals, self)
+        with open(fpath, 'rb') as fobj:
+            code = compile(fobj.read(), fpath, 'exec')
+        exec(code, scriptglobals, self)
         for name, type in TYPE_CHECKS:
             if name in self:
                 if not isinstance(self[name], type):