#35 StringCol error in version 1.1 ?

closed-fixed
nobody
None
5
2005-09-06
2005-08-24
Anonymous
No

I tried to build a PyTable holding tables of string tuples.
The following code is a test code for that purpose. The
code worked with PyTable version up to 1.0 and failed
with 1.1. The code is supposed to print the same
content twice. One thing I realized is that version 1.0
recognizes 'str_tuple' in the code as RecArray while
version 1.1 does it as NestedRecArray and gave me
wrong outputs. I attached sample outputs following the
code below. I used Python 2.3 and corresponding
PyTable pre-compiled bin for Windows with HDF5 dll
version 1.6.4 (not the .NET version) pre-built for
Windows.
------------------------------------------------------------------------------
from tables import *
from numarray import *
h5f = openFile("test.h5", "w")
class str_tuple(IsDescription):
str_tuple = StringCol(1, None, 3, 1)
grp = h5f.createGroup('/', 'tables',"a group holding
tables")
table = h5f.createTable(grp, "tuples", str_tuple, "a table
consisting of string tuples")

astr_lst = table.row
astr_lst["str_tuple"] = ("f","t","a")
astr_lst.append()
table.flush()

astr_lst = table.row
astr_lst["str_tuple"] = ("1","2","3")
astr_lst.append()
table.flush()

print h5f
print table[:]
h5f.close()

h5f = openFile("test.h5", "r")
table = h5f.root.tables.tuples
print table[:]
-------------------------------------------------------------------------
OUTPUT with version 1.0
test.h5 (File) ''
Last modif.: 'Wed Aug 24 15:50:58 2005'
Object Tree:
/ (RootGroup) ''
/tables (Group) 'a group holding tables'
/tables/tuples (Table(2L,)) 'a table consisting of string
tuples'

RecArray[
(CharArray(['f', 't', 'a'])),
(CharArray(['1', '2', '3']))
]
RecArray[
(CharArray(['f', 't', 'a'])),
(CharArray(['1', '2', '3']))
]
---------------------------------------------------------------------
OUTPUT with version 1.1
test.h5 (File) ''
Last modif.: 'Wed Aug 24 15:52:03 2005'
Object Tree:
/ (RootGroup) ''
/tables (Group) 'a group holding tables'
/tables/tuples (Table(2L,)) 'a table consisting of string
tuples'

NestedRecArray[
(CharArray(['f', 't', 'a'])),
(CharArray(['1', '2', '3']))
]
NestedRecArray[
('f'),
('t')
]

Discussion

  • Ivan Vilata i Balaguer

    Logged In: YES
    user_id=1064183

    This bug was related with rank 1 multi-dimensional string
    column creation. It has been fixed in the development
    version and will be available in the forthcoming 1.1.1
    release. A simple patch to fix this bug is attached.

     
  • Ivan Vilata i Balaguer

    • status: open --> closed-fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks