osPlanning / omx

Open Matrix (OMX)
https://github.com/osPlanning/omx/wiki
Apache License 2.0
50 stars 18 forks source link

Python API - bug caused by compatibility issues with the tables module #29

Closed rluthi closed 8 years ago

rluthi commented 8 years ago

I got this error using the method createMapping() from the Python API:

--> 172         mymap = self.createArray(self.root.lookup, title, atom=tables.UInt32Atom(),AttributeError: 'File' object has no attribute 'createArray'`
It turns out that in my "tables" module (version 3.3.0) the method createArray() is called crate_array().

I fixed this bug localy by manually changing one line in the createMapping(self, title, entries, overwrite=False) method of the File class.

The original code was:

# Write the mapping!
mymap = self.createArray(self.root.lookup, title, atom=tables.UInt32Atom(),
shape=(len(entries),) )

I replaced it by:

# Write the mapping!
mymap = self.create_array(self.root.lookup, title, atom=tables.UInt32Atom(),
shape=(len(entries),) )

For information, I am using Python 2.7.3, and the openmatrix version 0.2