From ec8c8c2ef2cac83a12b249c4e6ba4c62c018bfdc Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Tue, 28 Jul 1998 17:30:06 +0000 Subject: [PATCH] fix __str__ method of EnvironmentError (base class of IOError): was using "%d" % errno to print out IOError exceptions -- but urllib.py raises exceptions where the errno slot in the exception tuple is a string. --- Lib/exceptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/exceptions.py b/Lib/exceptions.py index 9eba588cb3a..a81ec3cb0ce 100644 --- a/Lib/exceptions.py +++ b/Lib/exceptions.py @@ -105,10 +105,10 @@ class EnvironmentError(StandardError): def __str__(self): if self.filename: - return '[Errno %d] %s: %s' % (self.errno, self.strerror, + return '[Errno %s] %s: %s' % (self.errno, self.strerror, self.filename) elif self.errno and self.strerror: - return '[Errno %d] %s' % (self.errno, self.strerror) + return '[Errno %s] %s' % (self.errno, self.strerror) else: return StandardError.__str__(self)