Hi colleagues, I have a little problem when executing my python script in a uipath sequence, exactly in the Get Python Object activity, I get the error Get Python Object: Error converting Python object.
I don’t understand why this can happen, taking into account that the return variable in my script is String type, and also the typeArgument is string
import speech_recognition as sr
import time
from pydub import AudioSegment
def convert_audio_to_text():
src = 'C:\\Users\\TTssRpaConba\\Desktop\\audio.mp3'
dst = 'C:\\Users\\TTssRpaConba\\Desktop\\audio.wav'
# convert wav to mp3
audSeg = AudioSegment.from_mp3(src)
audSeg.export(dst, format="wav")
r = sr.Recognizer()
with sr.AudioFile(dst) as source:
# print("Say Something...")
audio = r.listen(source)
try:
text = r.recognize_google(audio, language='en-US')
time.sleep(1.5)
return text
except:
return "I am sorry I can not understand"