Unable to Run python script from Robot framework



       import json    
       def getElementCount(jsonObj):

       data1 = json.dumps(jsonObj)
       item_dict = json.loads(data1)

       print len(countElement) 
       return countElement

Robot framework

       Library           Sample.py

       ** Test Cases ***

       [TC-001]-Registering a device with INVALID SUBSCRIBER name 

       ${ResponseJson}=    Customer Method API Call ${host}   ${apivalue}

       ${value} =    Call Method  getElementCount ${ResponseJson}

Description of Error

It is not working can someone please help with above solution

I want to call to above python method from robot framework and also pass ${ResponseJson} value to above python method. And after identifying length result should be return to robot framework.

i already went through below link but dint understand meaning of call method.

Asked By: user7684126



Call method is for calling methods on objects. When you import a library, you don’t get objects.

When you import a module as a library, every function becomes a keyword. Therefore you can directly call getElementCount:

   ** Test Cases ***
   ${value} =    getElementCount  ${ResponseJson}
Answered By: Bryan Oakley

I am facing issue while importing paramiko…
normally witout paramiko will work..for below code getting No keyword with name ‘getconnectionconfig’ found.
*** Settings ***
Library SeleniumLibrary
Library Test4.py

*** Test Cases ***
Class : Test
${Result} = getconnectionconfig
log to console ${Result}


from datetime import datetime
import paramiko

global ssh, channel
ssh = paramiko.SSHClient()

def cur_time():
    return datetime.now().strftime("%H:%M:%S")

def getconnectionconfig():
    global channel
    ssh.connect('', username='root', password='root')
    channel = ssh.invoke_shell()
    print("Current Time is : [" + cur_time() + "] Connection Successful with 
Answered By: Basavraj R
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.