ValueError when opening a read-only hdf twice
See original GitHub issueIn [3]: with pd.HDFStore('/tmp/file_I_can_only_read.hdf') as store:
...: store['test'] = pd.Series(range(3))
...:
In [4]: os.chmod('/tmp/file_I_can_only_read.hdf', 0o400)
In [5]: store1 = pd.HDFStore('/tmp/file_I_can_only_read.hdf')
Opening /tmp/file_I_can_only_read.hdf in read-only mode
In [6]: store2 = pd.HDFStore('/tmp/file_I_can_only_read.hdf')
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-6-5b173bb4a3e8> in <module>()
----> 1 store2 = pd.HDFStore('/tmp/file_I_can_only_read.hdf')
/home/pietro/nobackup/repo/pandas/pandas/io/pytables.py in __init__(self, path, mode, complevel, complib, fletcher32, **kwargs)
402 self._fletcher32 = fletcher32
403 self._filters = None
--> 404 self.open(mode=mode, **kwargs)
405
406 @property
/home/pietro/nobackup/repo/pandas/pandas/io/pytables.py in open(self, mode, **kwargs)
563 hdf_version=tables.get_hdf5_version()))
564
--> 565 raise e
566
567 except (Exception) as e:
/home/pietro/nobackup/repo/pandas/pandas/io/pytables.py in open(self, mode, **kwargs)
538
539 try:
--> 540 self._handle = tables.open_file(self._path, self._mode, **kwargs)
541 except (IOError) as e: # pragma: no cover
542 if 'can not be written' in str(e):
/usr/lib/python3/dist-packages/tables/file.py in open_file(filename, mode, title, root_uep, filters, **kwargs)
308 "The file '%s' is already opened, but "
309 "in read-only mode. Please close it before "
--> 310 "reopening in append mode." % filename)
311 # 'w' means that we want to destroy existing contents
312 elif mode == 'w':
ValueError: The file '/tmp/file_I_can_only_read.hdf' is already opened, but in read-only mode. Please close it before reopening in append mode.
Issue Analytics
- State:
- Created 8 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Close HDF File After to_hdf() using mode='a' - Stack Overflow
I want to save a series of DataFrame using pandas into hdf file. ... The file 'append.h5' is already opened, but not in...
Read more >Source code for tables.file - PyTables
'r': raise ValueError( "The file '%s' is already opened, but " "not in read-only mode (as requested)." % filename) # 'a' and 'r+'...
Read more >IO tools (text, CSV, HDF5, …) — pandas 1.5.2 documentation
Row number(s) to use as the column names, and the start of the data. Default behavior is to infer the column names: if...
Read more >1156354 – ValueError: cannot modify protected device
First of all, I twice tried guided partitioning. I saw an error on the main hub, but when I entered the storage spoke,...
Read more >pysam documentation - Read the Docs
ValueError – if htsfile is closed or index could not be opened. ... The first level contains the record (HD, SQ, etc) and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
it’s much better to have an explicit error
The default on read-only stores is read, but as you prefer.