我正在尝试读取一个项目的所有功能数据,在Rally中使用pyral模块。结果集总数为1358,脚本在读取大约700条记录后抛出错误,如下所述。
rally1 = Rally(entity='PortfolioItem_Feature',server='rally1.rallydev.com',fetch=True, user='xxx', password='', workspace='xxx/yyy', project='ABC')
features = rally1.get('Feature',fetch="True",pagesize=2000,start=0,limit=5000)
for feature in features:
#a=pd.DataFrame(feature)
print(feature.details())产出:
PortfolioItem/Feature result set, totalResultSetSize: 1358, startIndex: 1 pageSize: 2000 current Index: 0
I'm getting the following errors:
File "C:\Users\nis\AppData\Roaming\Python\Python38\site-packages\pyral\entity.py", line 397, in details
(attr_name, cln, value.oid, value.UserName, value.DisplayName)
File "C:\Users\nis\AppData\Roaming\Python\Python38\site-packages\pyral\entity.py", line 139, in __getattr__
raise UnreferenceableOIDError("%s OID %s" % (rallyEntityTypeName, self.oid))
pyral.entity.UnreferenceableOIDError: User OID 44012386960因此,我有以下问题:
我正在使用下面的代码,这个脚本也读大约。700条记录,并抛出与上述相同的错误。我试着使用错误处理,但它在遇到错误时停止阅读。任何帮助都将不胜感激。
r=pd.DataFrame()
for feature in features:
a= {
'OID': feature.oid,
'FeatureID':feature.FormattedID,
'Creation_Date': feature.CreationDate,
'Project_Name': feature.Project.Name,
'AcceptedLeafStoryPlanEstimateTotal':feature.AcceptedLeafStoryPlanEstimateTotal,
'AcceptedLeafStoryPlanEstimateTotal':feature.AcceptedLeafStoryPlanEstimateTotal,
'Feature_payload':feature._ref,
'Created by':feature.CreatedBy.DisplayName
}
#print(a.keys())
#print(a.values())
r=r.append(a,ignore_index=True,sort=False)
print(r)发布于 2021-02-26 20:40:06
在我看来,id 44012386960的对象坏了,所以你必须跳过它。
for feature in features:
if feature.oid == 44012386960:
continue
print(feature.details())我假设您的错误是一个糟糕的特性,因为它也发生在您的第二个循环中,它只使用feature.oid,但是feature.CreatedBy也有可能是问题所在,因为您的错误消息表明它是一个糟糕的用户。在这种情况下,我的建议是在循环中打印feature.CreatedBy.oid以查找坏的,并将if更改为if feature.CreatedBy.oid == 44012386960: continue。
发布于 2021-04-04 04:22:13
我在python中使用三元操作符解决了这个问题,如下所示:
feature_name = '' if feature.Feature is None else feature.Feature.Name当Rally rest无法引用引起错误的特定特性时,问题就出现了。
https://stackoverflow.com/questions/64797224
复制相似问题