2013-05-06 59 views
0

我想按照列排序pytable,然后用itersorted反向迭代使用负步骤。根据文档这是可能的:反向迭代pytable用itersorted和负步骤产生OverflowError

OverflowError:不能负的值转换为无符号PY_LONG_LONG

http://pytables.github.io/usersguide/libref.html?highlight=itersorted#tables.Table.itersorted

但是,我得到的,当我用步= -1以下错误

如果步骤是肯定的,则错误不会发生。 我已经用pytables 2.4和3.0.0b1试过了,两者都有同样的问题。

任何想法为什么会发生这种情况?这是一个错误?我需要做点别的吗?

我附上最低工作例如:

import tables 

class IndexRecord(tables.IsDescription): 
    frame = tables.Int32Col(pos=1) 
    key = tables.StringCol(itemsize=40, pos=2)  

h5 = tables.openFile("trace.h5", 'w') 
index = h5.createTable(h5.root, "index", IndexRecord) 


index.append([(0, 'A')]) 
index.append([(1, 'B')]) 
index.append([(3, 'C')]) 
index.append([(4, 'D')]) 
index.flush() 

index.cols._f_col('frame').createCSIndex() 
for row in index.itersorted('frame', step=-1): #<-crashes here! 
    print row['frame'], row['key'] 

回答