Forwarding to the list. ~Josh
Begin forwarded message:
> From: pytables-users-boun...@lists.sourceforge.net
> Date: November 4, 2011 1:16:34 AM GMT+01:00
> To: pytables-users-ow...@lists.sourceforge.net
> Subject: Auto-discard notification
>
> The attached message has been automatically discarded.
> From: "Edward C. Jones" <edcjo...@comcast.net>
> Date: November 4, 2011 1:14:17 AM GMT+01:00
> To: pytables-users@lists.sourceforge.net
> Subject: Changes in container attributes not preserved in the h5 file
>
>
> My computer has an up-to-date Debian stable distribution installed. It comes
> with Python 2.6.6.
> I have compiled and installed PyTables 2.3.
>
> Here are two small programs:
>
> Program 1:
>
> #! /usr/bin/env python
>
> import tables
>
> h5file = tables.openFile("table1.h5", mode = "w")
>
> class silly_class(tables.IsDescription):
> char = tables.StringCol(1, pos=1)
>
> mytable = h5file.createTable(h5file.root, 'silly', silly_class, "silly")
> mytable.attrs.myint = 5
> mytable.attrs.mylist = [0, 1]
> mytable.attrs.mydict = {1 : 'a', 2 : 'b'}
> mytable.attrs.myint += 2
> mytable.attrs.mylist.append(2)
> mytable.attrs.mydict[3] = 'c'
> print mytable.attrs.myint, mytable.attrs.mylist, mytable.attrs.mydict
> h5file.close()
>
> Program 2:
>
> #! /usr/bin/env python
>
> import tables
>
> h5file = tables.openFile("table1.h5", mode = "r+")
> print h5file.root.silly.attrs.myint, h5file.root.silly.attrs.mylist, \
> h5file.root.silly.attrs.mydict
> h5file.close()
>
> I run program 1 and the printout is: "7 [0, 1, 2] {1: 'a', 2: 'b', 3: 'c'}".
> Then I run program 2 where the printout is: "7 [0, 1] {1: 'a', 2: 'b'}".
>
> When an attribute is a Python container, and I make changes inside the
> container, these changes
> are not present when "table1.h5" is reopened. What am I doing wrong?
>
>
>
------------------------------------------------------------------------------
RSA(R) Conference 2012
Save $700 by Nov 18
Register now
http://p.sf.net/sfu/rsa-sfdev2dev1
_______________________________________________
Pytables-users mailing list
Pytables-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pytables-users