Kimomaru
Kimomaru

Reputation: 1023

Resolving TypeError: 'str' object is not callable

I've tried researching this issue, but it appears like the causes for it can be varied and would like some input. The following line;

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

Incurs the error;

TypeError: 'str' object is not callable

I've tried restructuring the line, but I can't seem to figure out the issue. I also have a similarly stuctured line in python2 which seems to work, but this one in python3 does run. Any help is appreciated.

I have the same type code, written in php;

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

Here is a version of the same code, going to a depracted WSDL, but seems to work fine;

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

Upvotes: 0

Views: 579

Answers (1)

matisetorm
matisetorm

Reputation: 853

I think you are trying to call a string as a function here, and that isn't possible. Specifically,

'CmSelectionCriteria'() Isn't valid.

"abc"() causes the same error. You can't execute a call on a string.

If CmSelectionCriteria is a function you have defined somewhere else, remove the quotes.

Upvotes: 2

Related Questions