mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
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.
This commit is contained in:
parent
168beada91
commit
eaa6e3c712
1 changed files with 6 additions and 6 deletions
|
@ -353,7 +353,7 @@ def create_results_log(results, dirname = ".", show_missing = 1,
|
||||||
lines = open(filename, 'r').readlines()
|
lines = open(filename, 'r').readlines()
|
||||||
except IOError, err:
|
except IOError, err:
|
||||||
print >> sys.stderr, "trace: Could not open %s for reading " \
|
print >> sys.stderr, "trace: Could not open %s for reading " \
|
||||||
"because: %s - skipping" % (`filename`, err.strerror)
|
"because: %s - skipping" % (`filename`, err)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -361,7 +361,7 @@ def create_results_log(results, dirname = ".", show_missing = 1,
|
||||||
except IOError, err:
|
except IOError, err:
|
||||||
sys.stderr.write(
|
sys.stderr.write(
|
||||||
'%s: Could not open %s for writing because: %s" \
|
'%s: Could not open %s for writing because: %s" \
|
||||||
"- skipping\n' % ("trace", `listfilename`, err.strerror))
|
"- skipping\n' % ("trace", `listfilename`, err))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# If desired, get a list of the line numbers which represent
|
# If desired, get a list of the line numbers which represent
|
||||||
|
@ -416,7 +416,7 @@ def create_results_log(results, dirname = ".", show_missing = 1,
|
||||||
open(os.path.join(dirname, "modules"), "w"))
|
open(os.path.join(dirname, "modules"), "w"))
|
||||||
except IOError, err:
|
except IOError, err:
|
||||||
sys.stderr.write("cannot save counts/modules " \
|
sys.stderr.write("cannot save counts/modules " \
|
||||||
"files because %s" % err.strerror)
|
"files because %s" % err)
|
||||||
|
|
||||||
if summary and sums:
|
if summary and sums:
|
||||||
mods = sums.keys()
|
mods = sums.keys()
|
||||||
|
@ -663,7 +663,7 @@ def main(argv = None):
|
||||||
run(t.trace, 'execfile(' + `progname` + ')')
|
run(t.trace, 'execfile(' + `progname` + ')')
|
||||||
except IOError, err:
|
except IOError, err:
|
||||||
_err_exit("Cannot run file %s because: %s" % \
|
_err_exit("Cannot run file %s because: %s" % \
|
||||||
(`sys.argv[0]`, err.strerror))
|
(`sys.argv[0]`, err))
|
||||||
|
|
||||||
elif count:
|
elif count:
|
||||||
t = Coverage(ignore)
|
t = Coverage(ignore)
|
||||||
|
@ -671,7 +671,7 @@ def main(argv = None):
|
||||||
run(t.trace, 'execfile(' + `progname` + ')')
|
run(t.trace, 'execfile(' + `progname` + ')')
|
||||||
except IOError, err:
|
except IOError, err:
|
||||||
_err_exit("Cannot run file %s because: %s" % \
|
_err_exit("Cannot run file %s because: %s" % \
|
||||||
(`sys.argv[0]`, err.strerror))
|
(`sys.argv[0]`, err))
|
||||||
except SystemExit:
|
except SystemExit:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ def main(argv = None):
|
||||||
open(counts_file, 'wb'))
|
open(counts_file, 'wb'))
|
||||||
except IOError, err:
|
except IOError, err:
|
||||||
_err_exit("Cannot save counts file %s because: %s" % \
|
_err_exit("Cannot save counts file %s because: %s" % \
|
||||||
(`counts_file`, err.strerror))
|
(`counts_file`, err))
|
||||||
|
|
||||||
elif report:
|
elif report:
|
||||||
old_counts, old_modules = marshal.load(open(counts_file, 'rb'))
|
old_counts, old_modules = marshal.load(open(counts_file, 'rb'))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue