From b3e60687652d65b49aa2b9db1ee232a1dece3ad4 Mon Sep 17 00:00:00 2001 From: NihalHarish Date: Thu, 18 Mar 2021 03:21:24 -0700 Subject: [PATCH] wrap with try except block --- smdebug/core/state_store.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/smdebug/core/state_store.py b/smdebug/core/state_store.py index 7757eb287..dd799c5a7 100644 --- a/smdebug/core/state_store.py +++ b/smdebug/core/state_store.py @@ -83,7 +83,11 @@ def _read_states_file(self): """ if os.path.exists(self._states_file): with open(self._states_file) as json_data: - parameters = json.load(json_data) + try: + parameters = json.load(json_data) + except json.decoder.JSONDecodeError: + logger.warning(f"{self._states_file} was empty") + return for param in parameters: ts_state = dict() ts_state[TRAINING_RUN] = param[TRAINING_RUN]