A Wednesday 03 November 2010 16:36:13 Charles Krohn escrigué: > Hello list, > > If you obtain a row iterator and then try to access a nonexistent > column, it should presumably raise a KeyError or something similar. > Instead it gives a TypeError when trying to raise an exception. > Here's a script to reproduce the problem: > > import sys > from tables import openFile > > f = openFile(sys.argv[1]) > table = f.getNode(sys.argv[2]) > # This works > row = table[0] > assert not 'nonexistent_col' in row > # This doesn't > row = [r for r in table.iterrows(0, 1)][0] > assert not 'nonexistent_col' in row > f.close() > > And here's the result I get when I run the above script on a valid > PyTables H5 file: > > ctkr...@ctkrohn-bigthink:~/Code/pytables_bug$ ./pytables_bug.py > ../fcr/h5/comp.h5 /t102010 > Traceback (most recent call last): > File "./pytables_bug.py", line 15, in <module> > assert not 'nonexistent_col' in row > File "tableExtension.pyx", line 1296, in > tables.tableExtension.Row.__contains__ > TypeError: raise: exception class must be a subclass of BaseException > Closing remaining open files: ../fcr/h5/comp.h5... done > > Is this expected behavior? FYI I'm using 2.2pro.
Well, the thing is that the `Row` class did not implement the `__contains__` special method. This was very easy to fix, so I fixed it :-) For details: http://pytables.org/trac/ticket/309 This will be integrated with the forthcoming 2.2.1 release. Thanks for reporting, -- Francesc Alted ------------------------------------------------------------------------------ Achieve Improved Network Security with IP and DNS Reputation. Defend against bad network traffic, including botnets, malware, phishing sites, and compromised hosts - saving your company time, money, and embarrassment. Learn More! http://p.sf.net/sfu/hpdev2dev-nov _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users