Fix another file left open

This commit is contained in:
Nick Hall 2016-05-27 23:31:59 +01:00
parent 0b22891858
commit 75ffd7c41b

View File

@ -155,7 +155,8 @@ class CLIDbManager:
dbid = "bsddb"
dbid_path = os.path.join(dirpath, "database.txt")
if os.path.isfile(dbid_path):
dbid = open(dbid_path).read().strip()
with open(dbid_path) as file:
dbid = file.read().strip()
if not self.is_locked(dirpath):
try:
database = self.dbstate.make_database(dbid)