A Monday 26 April 2010 21:34:00 Anthony Foglia escrigué: > I'm running PyTables 2.1.2 which HDF5 version 1.8.4. As I've mentioned > earlier I have some code that has multiple file handles to a single > file, one for writing, others for reading. I'm trying to refactor my > code to avoid this, but I've stumbled across this bug. > > > In [1]: import tables > > In [2]: fyle = tables.openFile("foo.h5") > > In [3]: fyle2 = tables.openFile("foo.h5",mode="a") > HDF5-DIAG: Error detected in HDF5 (1.8.4) thread 0: [clip]
> I understand what I'm doing is not well accepted, but PyTables should be > robust enough to handle it in a stable manner. (I don't even understand > the "Can't open the group: '/'" error as the file obviously has one.) This has been addressed in 2.2 series. In trunk, you have: In [1]: import tables In [2]: fyle = tables.openFile("/tmp/file1.h5") In [3]: fyle2 = tables.openFile("/tmp/file1.h5",mode="a") In [4]: fyle Out[4]: File(filename=/tmp/file1.h5, title='', mode='r', rootUEP='/', filters=Filters(complevel=0, shuffle=False, fletcher32=False)) / (RootGroup) '' In [5]: fyle2 Out[5]: File(filename=/tmp/file1.h5, title='', mode='r', rootUEP='/', filters=Filters(complevel=0, shuffle=False, fletcher32=False)) / (RootGroup) '' But, as you can see, `fyle2` is opened in read-only mode (it is basically a pointer to existing `fyle` handler). Mmh, I'm not sure whether this is good practice or the second opening should fail with something like: raise ValueError( "The file '%s' is already opened. Please " "close it before reopening in 'a'ppend mode." % filename) What do you think is more convenient? -- Francesc Alted ------------------------------------------------------------------------------ _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users