I didn’t understand why when I imported the Keyword library into the python file. In the test file, the import gives an error: TypeError: ‘module’ object is not callable
You mean you still have the error?
I understand you set properly the library in python file but is the link to the python correct in the robot file/settings section?
As it doesn’t print anything, I imagined that it doesn’t even enter the Python function. And that the call was incorrect. I’m increasing the getData function and I’m going to try the robot call again and I’ll come back here to let you know how it was resolved. Thanks!
The issue in your example is probably that you are using python “print” instead of returning the value, when you print in a python class the message wilI not be shown on RF console, returning the value in the def should work
Python.py
import json
def get_data(registro):
return registro
Archive Robot
Library …/scripts/getData.py
GETDATA TESTE
${valor_body} get data teste
Log To Console Valor getData:Mensagem getData${valor_body}
Also if you want to print within a python class and see the logs in RF you could do so importing the RF logger RF logger
from robot.api import logger
def write_to_console():
logger.console("hello world")
Also double check your import to the library, make sure …/scripts/getData.py is the actual path to your python file from the context of where you are executing it