Nicer display of OSError exception messages

This commit is contained in:
Sebastian Lohff 2012-11-12 19:47:16 +01:00
parent affa42dae8
commit d54b3f5b8d
1 changed files with 2 additions and 2 deletions

View File

@ -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