Support > Forums > OpenBots Studio > Output in Python script

Output in Python script

Carlos Cabezas

  • Reporter
  • Calender Icon January 06,2023 at 4:39 PM

Hi, I'm testing the Python and C# scripts in my project, but I can't get any output from the Python script, I just get an empty ("") string.

The script is very simple, since I'm testing the output.

import sys

def return_abc(): return "abc"

return_abc()

I have a variable (String) assigned to the output, but I don't get anything.

This forum has 317 topics, 687 replies, and was last updated 4 months ago by Nataly Alvarado...

Nataly Alvarado...

  • Participant
  • Calender Icon January 12,2023 at 5:30 PM

Hi ccabezas,

Please note that the python commands are based on the console output invocation, equivalent of running a python script using the "python 'FILEPATH.py'" command.

Because of this, the output needs to be formatted accordingly. For example, based on the sample shared, you would need to print the return_abc function. See sample below:

import sys import ctypes

def return_abc(): str = 'abc' return str

print(return_abc()) ​

Note that additional features to the python commands and integration will be included in upcoming releases. ​ Stay tuned!

Carlos Cabezas

  • Participant
  • Calender Icon January 06,2023 at 4:41 PM

PS: Since the forum changed the format of the script, I will clarify that I have the correct indentation.

You are not authorized to reply, please click here to login and add your reply to this topic.