我的None检查不起作用继续获取“NoneType object has no attribute XXX”

2024-05-14 06:19:50 发布

您现在位置:Python中文网/ 问答频道 /正文

我以前遇到过这个错误。它通常意味着我试图使用和方法来处理空对象。所以我付了支票,但是支票似乎不起作用。这是我的代码:

    possiblechildSet= MXServer.getMXServer().getMboSet("ASSETANCESTOR", userinfo)
    possiblechildSet.setWhere("ANCESTOR='" mbo.getString("ASSETNUM") "' and ASSETNUM !='" mbo.getString("ASSETNUM") "'")
    if (possiblechildSet.count() <> 0) or (possiblechildSet.count() is not None) :
        childSet= mbo.getMboSet("ASSETMISSINGCHILD")
        if childSet.count() is not None:
            childMbo = childSet.getMbo(0)
            childassetnum = childMbo.getString('ASSETNUM') //error

我尝试使用getString方法时遇到错误。这是有效的。我以前在多个脚本中用过这种方法。我只是不明白怎么通过我的支票。 任何帮助都将不胜感激。 谢谢 万恩


Tags: 方法noneifiscount错误not支票