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.
This commit is contained in:
parent
ee7fd697bf
commit
ec8c8c2ef2
|
@ -105,10 +105,10 @@ class EnvironmentError(StandardError):
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
if self.filename:
|
if self.filename:
|
||||||
return '[Errno %d] %s: %s' % (self.errno, self.strerror,
|
return '[Errno %s] %s: %s' % (self.errno, self.strerror,
|
||||||
self.filename)
|
self.filename)
|
||||||
elif self.errno and self.strerror:
|
elif self.errno and self.strerror:
|
||||||
return '[Errno %d] %s' % (self.errno, self.strerror)
|
return '[Errno %s] %s' % (self.errno, self.strerror)
|
||||||
else:
|
else:
|
||||||
return StandardError.__str__(self)
|
return StandardError.__str__(self)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue