Skip to content

Instantly share code, notes, and snippets.

@gidden
Created June 13, 2014 17:13
Show Gist options
  • Save gidden/54ca4f9f41a4060ebec9 to your computer and use it in GitHub Desktop.
Save gidden/54ca4f9f41a4060ebec9 to your computer and use it in GitHub Desktop.
pytables failure on void col dtype
import numpy as np
import tables as t
import uuid
id = uuid.uuid4()
h5file = t.open_file(".tmp{0}".format(id), mode='w',)
dtype = np.dtype([('id', (np.void, 16))])
h5file.create_table(h5file.root, "hi", dtype)
@gidden
Copy link
Author

gidden commented Jun 13, 2014

fails with

In [39]: h5file.create_table(h5file.root, "hi", dtype)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-39-ac36de9a0d1d> in <module>()
----> 1 h5file.create_table(h5file.root, "hi", dtype)

/home/gidden/.local/lib/python2.7/site-packages/tables/file.pyc in create_table(self, where, name, description, title, filters, expectedrows, chunkshape, byteorder, createparents, obj)
   1065                       description=description, title=title,
   1066                       filters=filters, expectedrows=expectedrows,
-> 1067                       chunkshape=chunkshape, byteorder=byteorder)
   1068 
   1069         if obj is not None:

/home/gidden/.local/lib/python2.7/site-packages/tables/table.pyc in __init__(self, parentnode, name, description, title, filters, expectedrows, chunkshape, byteorder, _log)
    820             if isinstance(description, numpy.dtype):
    821                 self.description, self._rabyteorder = \
--> 822                     descr_from_dtype(description)
    823 
    824         # No description yet?

/home/gidden/.local/lib/python2.7/site-packages/tables/description.pyc in descr_from_dtype(dtype_)
    772         # Nested column
    773         elif kind == 'V' and dtype.shape in [(), (1,)]:
--> 774             col, _ = descr_from_dtype(dtype)
    775             col._v_pos = pos
    776         else:

/home/gidden/.local/lib/python2.7/site-packages/tables/description.pyc in descr_from_dtype(dtype_)
    757     fields = {}
    758     fbyteorder = '|'
--> 759     for name in dtype_.names:
    760         dtype, pos = dtype_.fields[name][:2]
    761         kind = dtype.base.kind

TypeError: 'NoneType' object is not iterable

@gidden
Copy link
Author

gidden commented Jun 13, 2014

looks like void isn't a valid hdf5 type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment