Ensure sys.argv[0] is the script name on Run Script.

This commit is contained in:
Guido van Rossum 1999-06-01 18:18:27 +00:00
parent 96cf271be9
commit ee03611a8d
1 changed files with 3 additions and 0 deletions

View File

@ -73,6 +73,9 @@ class ScriptBinding:
flist = self.editwin.flist flist = self.editwin.flist
shell = flist.open_shell() shell = flist.open_shell()
interp = shell.interp interp = shell.interp
if (not sys.argv or
os.path.basename(sys.argv[0]) != os.path.basename(filename)):
sys.argv = [filename]
interp.execfile(filename) interp.execfile(filename)
def getfilename(self): def getfilename(self):