Thanks Ivan. The nrows tip is handy.
Note that the problem is more widespread than just getting the length of a table. For instance, createIndex() fails, as does ptrepack (this is with python 2.5 on a 32 bit machine). How hard is it to fix the pytables code for these bits to work around the limits? It looks that for now, I'll have to keep tables below 1 billion records if I don't want to move to a 64 bit machine. John Ivan Vilata i Balaguer wrote: > This is a limitation of the Python interpreter itself in versions <= 2.4 > and 32-bit 2.5. You can read more about the fact at > http://docs.python.org/whatsnew/pep-353.html > > In short, Python can't use indexes greater than 2**31-1 in versions up > to 2.4, and in version 2.5 running on 32-bit machines. Python 2.5 on > 64-bit machines fully supports 64-bit indexes. As an illustration, > the following code:: > > class Foo(object): > def __len__(self): > return 2**40 > > f = Foo() > print len(f) > > prints ``1099511627776`` under 64-bit Python 2.5, fails with > ``OverflowError: long int too large to convert to int`` on a 32-bit > machine, and fails with ``OverflowError: __len__() should return 0 <= > outcome < 2**31`` with 64-bit Python 2.4. > > So, if you need to use the length of a dataset, your best option is to > use the ``nrows`` attribute (``h.root.events.nrows`` in the example), > which is a NumPy signed 64-bit integer regardless of the platform and > Python version. It is available for all datasets in PyTables. > > Hope that helps, > > :: > > Ivan Vilata i Balaguer >qo< http://www.carabos.com/ > Cárabos Coop. V. V V Enjoy Data > "" > *********************************************************************************** Renaissance Services of Europe Limited Company Reg. No. 393163 Registered Office: 1st Floor, Hardwicke House, Hatch Street, Dublin 2, Ireland. *********************************************************************************** Employees of Renaissance Services of Europe Limited do not have the authority to bind contracts on behalf of Renaissance Reinsurance Limited (Bermuda), Renaissance Reinsurance of Europe, Davinci Re or Top Layer Re. This e-mail, including attachments, may contain information that is privileged, proprietary, non-public, confidential or exempt from disclosure and is intended to be conveyed only to the designated recipient(s). If you are not an intended recipient, please delete this email, including attachments, and do not disseminate, distribute or copy this communication, by email or otherwise. The unauthorized use, dissemination, distribution or reproduction of this email, including attachments, is prohibited and may be unlawful. We reserve the right to monitor and review the content of all messages sent to or from this e-mail address. ********************************************************************************* ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users