[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[minion-cvs] When we can"t read the server"s directory, give a reaso...
Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv23519/lib/mixminion/server
Modified Files:
ServerMain.py
Log Message:
When we can't read the server's directory, give a reasonable error.
Index: ServerMain.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/ServerMain.py,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- ServerMain.py 30 May 2003 03:07:56 -0000 1.65
+++ ServerMain.py 2 Jun 2003 17:54:57 -0000 1.66
@@ -40,6 +40,7 @@
__all__ = [ 'MixminonServer' ]
+import errno
import getopt
import os
import sys
@@ -77,10 +78,19 @@
versionFile = os.path.join(homeDir, "version")
if not os.path.exists(homeDir):
return None
- elif not os.path.exists(versionFile):
- dirVersion = "1000"
else:
- dirVersion = readFile(versionFile).strip()
+ try:
+ dirVersion = readFile(versionFile).strip()
+ except (OSError, IOError), e:
+ if e.errno == errno.ENOENT:
+ # The file doesn't exist; the version must be '1000'.
+ dirVersion = "1000"
+ elif e.errno == errnoe.EACCES:
+ raise UIError("You don't have permission to read %s"%
+ versionFile)
+ else:
+ raise UIError("Unexpected error while reading %s: %s",
+ versionFile, e)
return dirVersion