summaryrefslogtreecommitdiffstats
path: root/Tools/idle/ScriptBinding.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-06-01 18:18:27 (GMT)
committerGuido van Rossum <guido@python.org>1999-06-01 18:18:27 (GMT)
commitee03611a8dd6ccb4ae408fbe2e43afda9d2da316 (patch)
tree319691f80e36dc689d676f7a26cca9ba1ac6c35e /Tools/idle/ScriptBinding.py
parent96cf271be9c7046eececc31aac5d65bc904a554d (diff)
downloadcpython-ee03611a8dd6ccb4ae408fbe2e43afda9d2da316.zip
cpython-ee03611a8dd6ccb4ae408fbe2e43afda9d2da316.tar.gz
cpython-ee03611a8dd6ccb4ae408fbe2e43afda9d2da316.tar.bz2
Ensure sys.argv[0] is the script name on Run Script.
Diffstat (limited to 'Tools/idle/ScriptBinding.py')
-rw-r--r--Tools/idle/ScriptBinding.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Tools/idle/ScriptBinding.py b/Tools/idle/ScriptBinding.py
index 94a248f..9af8236 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):