Address ResourceWarning warnings
Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
@@ -98,17 +98,16 @@ class Persister:
|
||||
if not os.path.exists(self._path):
|
||||
return
|
||||
|
||||
handle = open(self._path, 'rb')
|
||||
import pickle
|
||||
|
||||
try:
|
||||
self.object = pickle.load(handle)
|
||||
logger.debug('loaded persisted object from %r', self._path)
|
||||
# FIXME: catching too general exception (Exception)
|
||||
except Exception as e:
|
||||
# can fail for various reasons; in that case, pretend we didn't
|
||||
# load it
|
||||
logger.debug(e)
|
||||
with open(self._path, 'rb') as handle:
|
||||
import pickle
|
||||
try:
|
||||
self.object = pickle.load(handle)
|
||||
logger.debug('loaded persisted object from %r', self._path)
|
||||
# FIXME: catching too general exception (Exception)
|
||||
except Exception as e:
|
||||
# can fail for various reasons; in that case, pretend we didn't
|
||||
# load it
|
||||
logger.debug(e)
|
||||
|
||||
def delete(self):
|
||||
self.object = None
|
||||
|
||||
Reference in New Issue
Block a user