Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eaa6e3c

Browse files
committed
Replace all instances of err.strerror with err.
The strerror attribute contained only partial information about the exception and produced some very confusing error messages. By passing err (the exception object itself) and letting it convert itself to a string, the error messages are better.
1 parent 168bead commit eaa6e3c

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

Tools/scripts/trace.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -353,15 +353,15 @@ def create_results_log(results, dirname = ".", show_missing = 1,
353353
lines = open(filename, 'r').readlines()
354354
except IOError, err:
355355
print >> sys.stderr, "trace: Could not open %s for reading " \
356-
"because: %s - skipping" % (`filename`, err.strerror)
356+
"because: %s - skipping" % (`filename`, err)
357357
continue
358358

359359
try:
360360
outfile = open(listfilename, 'w')
361361
except IOError, err:
362362
sys.stderr.write(
363363
'%s: Could not open %s for writing because: %s" \
364-
"- skipping\n' % ("trace", `listfilename`, err.strerror))
364+
"- skipping\n' % ("trace", `listfilename`, err))
365365
continue
366366

367367
# If desired, get a list of the line numbers which represent
@@ -416,7 +416,7 @@ def create_results_log(results, dirname = ".", show_missing = 1,
416416
open(os.path.join(dirname, "modules"), "w"))
417417
except IOError, err:
418418
sys.stderr.write("cannot save counts/modules " \
419-
"files because %s" % err.strerror)
419+
"files because %s" % err)
420420

421421
if summary and sums:
422422
mods = sums.keys()
@@ -663,15 +663,15 @@ def main(argv = None):
663663
run(t.trace, 'execfile(' + `progname` + ')')
664664
except IOError, err:
665665
_err_exit("Cannot run file %s because: %s" % \
666-
(`sys.argv[0]`, err.strerror))
666+
(`sys.argv[0]`, err))
667667

668668
elif count:
669669
t = Coverage(ignore)
670670
try:
671671
run(t.trace, 'execfile(' + `progname` + ')')
672672
except IOError, err:
673673
_err_exit("Cannot run file %s because: %s" % \
674-
(`sys.argv[0]`, err.strerror))
674+
(`sys.argv[0]`, err))
675675
except SystemExit:
676676
pass
677677

@@ -699,7 +699,7 @@ def main(argv = None):
699699
open(counts_file, 'wb'))
700700
except IOError, err:
701701
_err_exit("Cannot save counts file %s because: %s" % \
702-
(`counts_file`, err.strerror))
702+
(`counts_file`, err))
703703

704704
elif report:
705705
old_counts, old_modules = marshal.load(open(counts_file, 'rb'))

0 commit comments

Comments
 (0)