From d9e4969c30d8df4ca8b02442fddcf8bcc32a966a Mon Sep 17 00:00:00 2001 From: Benedikt Sauer Date: Wed, 25 Feb 2015 13:36:58 +0100 Subject: [PATCH] Open HDF5 file in ro mode if no other mode was passed. Currently the `HDFStore` is opened in `rw` mode by default, leading to permission errors when reading a non-writeable file. --- doc/source/whatsnew/v0.16.0.txt | 1 + pandas/io/pytables.py | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/source/whatsnew/v0.16.0.txt b/doc/source/whatsnew/v0.16.0.txt index ead3c79430bf9..ecc497f98a5be 100644 --- a/doc/source/whatsnew/v0.16.0.txt +++ b/doc/source/whatsnew/v0.16.0.txt @@ -344,3 +344,4 @@ Bug Fixes - Bug in groupby MultiIndex with missing pair (:issue:`9049`, :issue:`9344`) - Fixed bug in ``Series.groupby`` where grouping on ``MultiIndex`` levels would ignore the sort argument (:issue:`9444`) - Fix bug in ``DataFrame.Groupby`` where sort=False is ignored in case of Categorical columns. (:issue:`8868`) +- Fix issue on when reading HDF5 files using ``read_hdf`` from a Windows file share without write-permissions. (:issue:`9551`) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 05510f655f7be..f376eff49473e 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -318,6 +318,7 @@ def read_hdf(path_or_buf, key, **kwargs): # can't auto open/close if we are using an iterator # so delegate to the iterator + kwargs.setdefault("mode", "r") store = HDFStore(path_or_buf, **kwargs) try: return f(store, True)