Skip to content

Commit 2582edc

Browse files
author
neal.norwitz
committed
SF bug #1457411, fix errors using variables that don't exist.
Rename file -> filename to be clear. Will backport. git-svn-id: http://svn.python.org/projects/python/trunk@43269 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent e6fc4de commit 2582edc

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

Tools/scripts/byext.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ def statargs(self, args):
1717
elif os.path.isfile(arg):
1818
self.statfile(arg)
1919
else:
20-
sys.stderr.write("Can't find %s\n" % file)
20+
sys.stderr.write("Can't find %s\n" % arg)
2121
self.addstats("<???>", "unknown", 1)
2222

2323
def statdir(self, dir):
2424
self.addstats("<dir>", "dirs", 1)
2525
try:
2626
names = os.listdir(dir)
2727
except os.error, err:
28-
sys.stderr.write("Can't list %s: %s\n" % (file, err))
29-
self.addstats(ext, "unlistable", 1)
28+
sys.stderr.write("Can't list %s: %s\n" % (dir, err))
29+
self.addstats("<dir>", "unlistable", 1)
3030
return
3131
names.sort()
3232
for name in names:
@@ -42,19 +42,19 @@ def statdir(self, dir):
4242
else:
4343
self.statfile(full)
4444

45-
def statfile(self, file):
46-
head, ext = os.path.splitext(file)
47-
head, base = os.path.split(file)
45+
def statfile(self, filename):
46+
head, ext = os.path.splitext(filename)
47+
head, base = os.path.split(filename)
4848
if ext == base:
4949
ext = "" # E.g. .cvsignore is deemed not to have an extension
5050
ext = os.path.normcase(ext)
5151
if not ext:
5252
ext = "<none>"
5353
self.addstats(ext, "files", 1)
5454
try:
55-
f = open(file, "rb")
55+
f = open(filename, "rb")
5656
except IOError, err:
57-
sys.stderr.write("Can't open %s: %s\n" % (file, err))
57+
sys.stderr.write("Can't open %s: %s\n" % (filename, err))
5858
self.addstats(ext, "unopenable", 1)
5959
return
6060
data = f.read()

0 commit comments

Comments
 (0)