]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fix __str__ method of EnvironmentError (base class of IOError): was
authorJeremy Hylton <jeremy@alum.mit.edu>
Tue, 28 Jul 1998 17:30:06 +0000 (17:30 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Tue, 28 Jul 1998 17:30:06 +0000 (17:30 +0000)
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

index 9eba588cb3ab665c395583569df566670c770765..a81ec3cb0ce9fc1eae14318ae671d5cad319730c 100644 (file)
@@ -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)