From d54b3f5b8d629d0f0b7c0606b93190b3f47240fd Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Mon, 12 Nov 2012 19:47:16 +0100 Subject: [PATCH] Nicer display of OSError exception messages --- servefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/servefile b/servefile index 17ce8c4..dd09628 100755 --- a/servefile +++ b/servefile @@ -892,7 +892,7 @@ class ServeFile(): testit = open(self.target, 'r') testit.close() except IOError as e: - raise ServeFileException("Error: Could not open file, %r" % e) + raise ServeFileException("Error: Could not open file, %r" % (str(e),)) FileHandler.filePath = self.target FileHandler.fileName = os.path.basename(self.target) FileHandler.fileLength = os.stat(self.target).st_size @@ -913,7 +913,7 @@ class ServeFile(): try: os.mkdir(self.target) except (IOError, OSError) as e: - raise ServeFileException("Error: Could not create directory '%s' for uploads, %r" % (self.target, e)) + raise ServeFileException("Error: Could not create directory '%s' for uploads, %r" % (self.target, str(e))) else: raise ServeFileException("Error: Upload directory already exists and is a file.") FilePutter.targetDir = self.target