Assert that the database exists on disk.
Print a reasonable error if it does not.
"""
- assert self.exists(), "Missing database file %s" % self.curpath()
+ if not self.exists():
+ raise missingDatabaseFile(self.curpath())
def _open(self) :
"Load the database from disk"
self._assert_exists()
self._records.append(['']*len(self._header))
return record
+class missingDatabaseFile (Exception) :
+ "Specified database file does not exist"
+ def __init__(self, path):
+ msg = "Missing database file %s" % path
+ Exception.__init__(self, msg)
+ self.path = path
+
class indexStringError (Exception) :
"invalid index string format"
pass