Skip to content

BUG: Removing a nonexistent store raises a KeyError (GH3346) #3447

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion RELEASE.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ pandas 0.12.0

**API Changes**

-
- When removing an object from a store, **store.remove(key)**, raises
**KeyError** if **key** is not a valid store object.

**Bug Fixes**

Expand Down
6 changes: 5 additions & 1 deletion pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,10 @@ def remove(self, key, where=None, start=None, stop=None):
-------
number of rows removed (or None if not a Table)

Exceptions
----------
raises KeyError if key is not a valid store

"""
try:
s = self.get_storer(key)
Expand All @@ -569,7 +573,7 @@ def remove(self, key, where=None, start=None, stop=None):
return None

if s is None:
return None
raise KeyError('No object named %s in the file' % key)

# remove the node
if where is None:
Expand Down
Loading