migration.py
branchstable
changeset 6696 160ca95eb4cc
parent 6687 0b1f5c14646e
child 6732 f63cef610b97
--- a/migration.py	Fri Nov 05 16:55:13 2010 +0100
+++ b/migration.py	Tue Nov 09 10:18:56 2010 +0100
@@ -334,14 +334,15 @@
         if not self.execscript_confirm(migrscript):
             return
         scriptlocals = self._create_context().copy()
+        scriptlocals.update({'__file__': migrscript,
+                             '__args__': kwargs.pop("scriptargs", [])})
         self._context_stack.append(scriptlocals)
         if script_mode == 'python':
             if funcname is None:
                 pyname = '__main__'
             else:
                 pyname = splitext(basename(migrscript))[0]
-            scriptlocals.update({'__file__': migrscript, '__name__': pyname,
-                                 '__args__': kwargs.pop("scriptargs", [])})
+            scriptlocals['__name__'] = pyname
             execfile(migrscript, scriptlocals)
             if funcname is not None:
                 try: