From: Tim C. <tc...@op...> - 2005-08-14 01:14:09
|
The following code used to work with PyTables 0.9 but now fails with PyTables 1.1, and I don't understand why. Can anyone provide some clues? Tim C ##################################### import time import sys import numarray import numarray.random_array as ra from numarray import memmap from tables import * nor=100000 #bnor=nor*100 bnor=nor*300 filters = None # Create a Table starttime = time.time() fileh = openFile("array1.h5", mode = "w") # Get the root group root = fileh.root # define table class class TestTable(IsDescription): mycol = FloatCol(pos=1) # create table mytable = fileh.createTable(root, 'testtable', TestTable, "Very Big Test table", filters=filters) rowsinbuf = mytable._v_expectedrows # load table with data for i in xrange(0, nor, rowsinbuf): mytable.append([numarray.arange(i, i+rowsinbuf, type="Float64")]) fileh.flush() print "Creating a %s element table and saving in PyTables took %.3f seconds" % (nor, time.time() - starttime) print fileh.close() ######################################## When run, it gives: Traceback (most recent call last): File "test2.py", line 28, in ? mytable.append([numarray.arange(i, i+rowsinbuf, type="Float64")]) File "/usr/local/lib/python2.4/site-packages/tables/Table.py", line 1252, in append raise ValueError, \ ValueError: rows parameter cannot be converted into a recarray object compliant with table '/testtable (Table(0,)) 'Very Big Test table''. The error was: <The row structure doesn't match that provided by the format specification> |