dragan savic (el 2008-03-11 a les 15:27:45 -0700) va dir::

> I did put the "string"  and now I get the following
> error:
> 
>   File
> "C:\Python24\Lib\site-packages\tables\description.py",
> line 169, in from_
> type
>     newatom = atom.Atom.from_type(type, shape, dflt)
>   File "C:\Python24\lib\site-packages\tables\atom.py",
> line 451, in from_type
>     return class_.from_kind(kind, itemsize, shape,
> dflt)
>   File "C:\Python24\lib\site-packages\tables\atom.py",
> line 500, in from_kind
>     raise ValueError( "no default item size for kind
> ``%s``"
> ValueError: no default item size for kind ``string``
> Closing remaining open files: TABLE_2_0_TEST.h5...
> done
> 
> I see now why it works for other types except the
> "string". Maybe this could be fixed by adding the
> itemsize along the string keyword like "string10". But
> then so should function split_type be modified...

The string kind doesn't use the ``kindN`` type notation because we found
it potentially confusing (e.g. ``string10`` is an -invalid- string of 10
bits, not 10 characters, which would be ``string80``), so you need to
specify kind and item size separately.  Also, there is no default item
size for the string kind, so you *must* give it explicitly.  For that
matter, you can use the ``from_kind()`` factory method like this:

    >>> tables.Atom.from_kind('string', 10)
    StringAtom(itemsize=10, shape=(), dflt='')

See the Appendix A of the Users' Guide for more details.

HTH,

::

        Ivan Vilata i Balaguer   >qo<   http://www.carabos.com/
               Cárabos Coop. V.  V  V   Enjoy Data
                                  ""

Attachment: signature.asc
Description: Digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to