A Wednesday 02 July 2008, Hans Fangohr escrigué: > Hi Francesc, > > thank you for the very prompt reply; your explanation makes sense and > I can see where this is coming from. > > Most likely, I will modify our code to strip off any white space in > the relevant places: this is not particularly nice but will guarantee > backwards compatibility with older files. This is only relevant for > small sets of metadata so it is not performance critical. > > In this context: Is there any way to extract from a pytables.h5 file > the information whether it was written with pytables1.0 or pytables > 2.0? If I had that information, I could use tidy and lean code for > the newer files.
Sure. Use the PYTABLES_FORMAT_VERSION attribute of the root. It has the value "2.0" (or higher) starting with PyTables 2.0. Here it is an example: In [13]: f1=tables.openFile("tbl1.h5") In [14]: f1.root._v_attrs.PYTABLES_FORMAT_VERSION Out[14]: '1.6' In [15]: f2=tables.openFile("tbl2.h5") In [16]: f2.root._v_attrs.PYTABLES_FORMAT_VERSION Out[16]: '2.0' As you can see, this reports the version of the *format file* and not the PyTables version. Cheers, -- Francesc Alted Freelance developer Tel +34-964-282-249 ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users