El dc 19 de 08 del 2009 a les 14:38 -0400, en/na Manning, Jonathan va escriure: > In testing other code, I stumbled across an exception when a user sets > PYTABLES_SYS_ATTR=False from openFile. > > The following patch is one way to fix it (silences the exception), but I'm > not sure I like the behavior still. The error comes from a few lines below, > where it tries to set FILTERS anyway. Should FILTERS be conditional on > PYTABLES_SYS_ATTR too? > > Index: tables/group.py > =================================================================== > --- tables/group.py (revision 4230) > +++ tables/group.py (working copy) > @@ -266,9 +266,9 @@ > > def _g_postInitHook(self): > if self._v_new: > + setAttr = self._v_attrs._g__setattr > if self._v_file.params['PYTABLES_SYS_ATTRS']: > # Save some attributes for the new group on disk. > - setAttr = self._v_attrs._g__setattr > # Set the title, class and version attributes. > setAttr('TITLE', self._v_new_title) > setAttr('CLASS', self._c_classId) > > > I prefer the following, which omits the pytables attribute FILTERS too, but > I'm not sure what will break (no failures with test_all light). > > Index: tables/group.py > =================================================================== > --- tables/group.py (revision 4230) > +++ tables/group.py (working copy) > @@ -274,15 +274,15 @@ > setAttr('CLASS', self._c_classId) > setAttr('VERSION', self._v_version) > > - # Set the default filter properties. > - newFilters = self._v_new_filters > - if newFilters is None: > - # If no filters have been passed in the constructor, > - # inherit them from the parent group, but only if they > - # have been inherited or explicitly set. > - newFilters = getattr(self._v_parent._v_attrs, 'FILTERS', > None) > - if newFilters is not None: > - setAttr('FILTERS', newFilters) > + # Set the default filter properties. > + newFilters = self._v_new_filters > + if newFilters is None: > + # If no filters have been passed in the constructor, > + # inherit them from the parent group, but only if they > + # have been inherited or explicitly set. > + newFilters = getattr(self._v_parent._v_attrs, 'FILTERS', > None) > + if newFilters is not None: > + setAttr('FILTERS', newFilters) > else: > # If the file has PyTables format, get the VERSION attr > if 'VERSION' in self._v_attrs._v_attrnamessys: >
Definitely the second is the correct one. Fixed in r4235 (trunk). Please, tell me if this fixes your problems. Francesc ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users