How to show output of python script

Installed python activity, How to display the output of Run Python Script activity.

Are you talking about output created by print() or something like the return of a function?

Yes, Output created by print() statement.

Currently the standard output is not captured by the Python activities.

As a workaround, you could output that to a file and then read that file with the robot.

can you please tell me how to run this code in uipath.

def add_numbers(x,y):
sum = x + y
return sum

num1 = 5
num2 = 6

print(“The sum is”, add_numbers(num1, num2))

Correctly mentioned the path for python in python scope

find the attached xaml.
python.xaml (7.4 KB)

In that case, you can get directly the return value of the function instead of reading it from the standard output To do that, just modify the type of the getload variable to int32 (since it’s returning an integer) and pass a couple of integers as input parameter (e.g., {2, 3}): (3.6 KB)

I modified the Python script a bit for the function to have default values, then you don’t even need to pass anything as input parameter.

Thank You @Mateus_Cruz

1 Like

hey @Mateus_Cruz,
Can you please help me out how can we run the below code in UiPath?
What changes we have to made in code?
how to store user speech and use it to write text?
Below code is working properly in python:

import speech_recognition as sr
r= sr.Recognizer()
with sr.Microphone() as source:
print(“say something”);
audio = r.listen(source)
print(“Time over, Thanks”)
print("Text: "+r.recognize_google(audio, language=‘mr-IN’));