summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1998-08-11 18:01:32 (GMT)
committerGuido van Rossum <guido@python.org>1998-08-11 18:01:32 (GMT)
commitbe21d98cee17b21d71fa61d0b5f0fedb62dc4f43 (patch)
tree8fa1fac6f2a441419d3936b122f0611eeed3ff05 /Lib
parentee9306b610f0a90c2f35e72c6e8f11d63aae6db3 (diff)
downloadcpython-be21d98cee17b21d71fa61d0b5f0fedb62dc4f43.zip
cpython-be21d98cee17b21d71fa61d0b5f0fedb62dc4f43.tar.gz
cpython-be21d98cee17b21d71fa61d0b5f0fedb62dc4f43.tar.bz2
Use repr() on the filename in EnvironmentError.__str__(). This
displays funny characters, like spaces or control characters, more clearly (one of my pet peeves in error messages). Also only suppress the filename if it is None; display it if it is '', since that would be a genuine (illegal) filename passed in!
Diffstat (limited to 'Lib')
-rw-r--r--Lib/exceptions.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/exceptions.py b/Lib/exceptions.py
index a81ec3c..28711df 100644
--- a/Lib/exceptions.py
+++ b/Lib/exceptions.py
@@ -104,9 +104,9 @@ class EnvironmentError(StandardError):
self.errno, self.strerror = args
def __str__(self):
- if self.filename:
+ if self.filename is not None:
return '[Errno %s] %s: %s' % (self.errno, self.strerror,
- self.filename)
+ repr(self.filename))
elif self.errno and self.strerror:
return '[Errno %s] %s' % (self.errno, self.strerror)
else: