2013-05-06 30 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'] 

回答