正在解析TypeError:“str”对象不是callab

2024-09-27 23:24:22 发布

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

我试着研究这个问题,但似乎它的原因可以是多种多样的,并希望一些投入。下一行

resultRisport70 = clientRisport70.service.selectCmDevice('','CmSelectionCriteria'({'SelectBy':'Name','Status':'Any','DeviceClass':'Phone','SelectItems':{'item':{'Item':'SEPblah'}}}))

引起错误

TypeError: 'str' object is not callable

我试过重新设计线路,但我似乎搞不清楚问题所在。我在python2中也有一条类似的构造线,看起来很管用,但是python3中的这条确实运行。感谢您的帮助。你知道吗

我有相同的类型代码,用php编写

$devices1 = $soapClient->selectCmDevice(array(
        'StateInfo' => '',
        'CmSelectionCriteria'=>
        (array(
            'DeviceClass'=>'Phone',
            'SelectBy'=>'Name',
            'Status'=>'Registered',
            'Protocol'=>'Any',
            'DownloadStatus'=>'Any',
            'SelectItems'=>array(
                'item'=>array(
                    'Item'=>'*' . $searchString . '*'
                ))))));

下面是同一个代码的一个版本,它是一个简化的WSDL,但似乎工作得很好

resultRisport70 = clientRisport70.service.SelectCmDevice('',{'SelectBy':'Name', 'Status':'Registered', 'Class':'Phone','SelectItems':{'SelectItem':{'Item':phoneDetailName}}})

Tags: namestatusservicephoneanyitemarrayselectby
1条回答
网友
1楼 · 发布于 2024-09-27 23:24:22

我认为您试图在这里调用字符串作为函数,这是不可能的。具体来说

'CmSelectionCriteria'() 无效。你知道吗

"abc"()会导致相同的错误。不能对字符串执行调用。你知道吗

如果CmSelectionCriteria是您在其他地方定义的函数,请删除引号。你知道吗

相关问题 更多 >

    热门问题