#40 File.copyNodeAttrs() wont take string as dest

closed-fixed
nobody
None
5
2006-03-09
2006-03-08
Mike Romberg
No

copyNodeAttrs() seems to work if the destination is
a node object. But fails if it is a string. Here
is an example. Ran with pytables-1.2.3.

import tables

fp = tables.openFile('test.h5', mode='w')
fp.setNodeAttr('/', 'foo', 'bar')
fp.createGroup('/', 'testg')
fp.copyNodeAttrs('/', '/testg')
fp.close()

Traceback (most recent call last):
File "test.py", line 7, in ?
fp.copyNodeAttrs('/', '/testg')
File
"/usr/lib/python2.4/site-packages/tables/File.py", line
1115, in copyNodeAttrs
srcObject._v_attrs._f_copy(dstnode)
File
"/usr/lib/python2.4/site-packages/tables/AttributeSet.py",
line 507, in _f_copy
raise TypeError("destination object is not a node:
%r" % (where,))
TypeError: destination object is not a node: '/testg'

Discussion

    • status: open --> closed
     
  • Logged In: YES
    user_id=1064183

    This was a little error in ``File.copyNodeAtts()`` itself.
    I has been fixed in the repository (both in trunk and
    std-1.2 branch).

    If you don’t want to get the repo version, you can simply go
    to the aforementioned method in ``tables/File.py`` and
    change the last line so that it looks like this::

    srcObject._v_attrs._f_copy(dstObject)

    Thanks for the report!

     
    • status: closed --> closed-fixed