Skip to content

Commit 4f765f7

Browse files
committed
Catch KeyError and close file properly
1 parent e3a2930 commit 4f765f7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pandas/io/pytables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ def read_hdf(path_or_buf, key=None, mode='r', **kwargs):
376376
'contains multiple datasets.')
377377
key = candidate_only_group._v_pathname
378378
return store.select(key, auto_close=auto_close, **kwargs)
379-
except (ValueError, TypeError):
379+
except (ValueError, TypeError, KeyError):
380380
# if there is an error, close the store
381381
try:
382382
store.close()

0 commit comments

Comments
 (0)