我在Python2.7中使用sqlalchemy作为ORM编写了以下代码:
if j.request.component:
comp_prod = (j.request.component.name, j.request.component.product.name)
else:
comp_prod = ('None', 'None')
但崩溃时出现以下错误:
File "/remote/vtghome9/vgtools2/python2.5/lib/python2.5/site-packages/ChImE-1.1-py2.5.egg/kachori/extra/streams.py", line 4110
comp_prod = (j.request.component.name, j.request.component.product.name)
AttributeError: 'NoneType' object has no attribute 'name'
我检查了“request”表,对于表中的一行,“component”为空。 我的问题是组件条目是否为NULL,也就是“i”。请求.组件“不应该是对的吗?它不应该在那个if条件下转到其他部分吗?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐