diff --git a/Tools/idle/ScriptBinding.py b/Tools/idle/ScriptBinding.py index 94a248f451e..9af8236ffd0 100644 --- a/Tools/idle/ScriptBinding.py +++ b/Tools/idle/ScriptBinding.py @@ -73,6 +73,9 @@ class ScriptBinding: flist = self.editwin.flist shell = flist.open_shell() interp = shell.interp + if (not sys.argv or + os.path.basename(sys.argv[0]) != os.path.basename(filename)): + sys.argv = [filename] interp.execfile(filename) def getfilename(self):