Skip to content

Commit dbadff7

Browse files
committed
BUG: Make HDFStore.remove re-raise the KeyError coming from select_column when the key is not a valid store
1 parent 10f511c commit dbadff7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/io/pytables.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,10 @@ def remove(self, key, where=None, start=None, stop=None):
887887
where = _ensure_term(where, scope_level=1)
888888
try:
889889
s = self.get_storer(key)
890-
except:
890+
except KeyError:
891+
# the key is not a valid store, re-raising KeyError
892+
raise
893+
except Exception:
891894

892895
if where is not None:
893896
raise ValueError(
@@ -899,9 +902,6 @@ def remove(self, key, where=None, start=None, stop=None):
899902
s._f_remove(recursive=True)
900903
return None
901904

902-
if s is None:
903-
raise KeyError('No object named %s in the file' % key)
904-
905905
# remove the node
906906
if com._all_none(where, start, stop):
907907
s.group._f_remove(recursive=True)

0 commit comments

Comments
 (0)