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

Skip to content

Commit ec8c8c2

Browse files
committed
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.
1 parent ee7fd69 commit ec8c8c2

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/exceptions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ def __init__(self, *args):
105105

106106
def __str__(self):
107107
if self.filename:
108-
return '[Errno %d] %s: %s' % (self.errno, self.strerror,
108+
return '[Errno %s] %s: %s' % (self.errno, self.strerror,
109109
self.filename)
110110
elif self.errno and self.strerror:
111-
return '[Errno %d] %s' % (self.errno, self.strerror)
111+
return '[Errno %s] %s' % (self.errno, self.strerror)
112112
else:
113113
return StandardError.__str__(self)
114114

0 commit comments

Comments
 (0)