Discussion:
[pytables-users] trying to save a byte array to VLArray..
Sridhar Anandakrishnan
2015-12-31 15:24:40 UTC
Permalink
Hi, I'm trying to save a byte array whose length is unknown beforehand.

I tried a VLArray, with a VLStringAtom (see below). It will store strings
but not byte arrays - what is the best way to store bytes in pytables?

pytables version is 3.1.1
and python is 3.4.2

Thanks,
Sridhar

vlsatom = tb.VLStringAtom()
vls = ststf.createVLArray(ststf.root, 'vlsarr', vlsatom, 'VLS array')
vls

Out[55]:
/vlsarr (VLArray(0,)) 'VLS array'
atom = VLStringAtom()
byteorder = 'little'
nrows = 0
flavor = 'numpy'

In [57]:

vls.append(b'abc')

TypeError: object is not a string: b'abc'


In [58]:

vls.append('xyz')

vls[0]

Out[60]:
b'xyz'
--
You received this message because you are subscribed to the Google Groups "pytables-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pytables-users+***@googlegroups.com.
To post to this group, send an email to pytables-***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...