Skip to content

Commit 3cfb626

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 744b046 commit 3cfb626

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

pandas/io/pytables.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,9 @@ 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 as ke:
891+
raise ke
892+
except Exception:
891893

892894
if where is not None:
893895
raise ValueError(
@@ -899,9 +901,6 @@ def remove(self, key, where=None, start=None, stop=None):
899901
s._f_remove(recursive=True)
900902
return None
901903

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

0 commit comments

Comments
 (0)