I have a fully functional Python Script which basically collects big data from a website using its API Key and then saves them as CSV in a local folder. Now my task is to run the script with Uipath.
My Python Scope properties are-
Input : path = where my .exe file is saved
target= x64
version= Python_36
Load Python Script:
File= where my .py script is saved
output= Load_out
Invoke Python Method
Input Parameters= I am confused about this value as I have multiple functions inside the python script
Instance= Load_out
Name= not sure again , assuming it is the function name that needs to be called ???
output = invoke_out
Get Python Object
Input= invoke_out
TypeArgument= DataTable , as i will have to save it as a CSV file
output= get_outDT
First of all I am getting an error about “Load Python Script: Error loading Python script” and the second problem is how do i give the input parameteres.
PS : the command that i used to run the script with command promt is:
Python Scope properties are-
Input : path = where your python.exe file is saved
target= x64
version= Python_36
Load Python Script:
File= The file name of your .py script, with the full path. In my case I store the Python script in the same folder as the process.
output= Load_out in your case, in my case PyScript_Load
Invoke Python Method
Input Parameters= The parameters of the function you want to call. In my case the directory where the Python script is stored.
Instance= Load_out in your case, in my case PyScript_Load
Name= The function name you want to call, in my case test
output = invoke_out in your case, in my case PyScript_Output
Get Python Object
Input= invoke_out in your case, in my case PyScript_Output
TypeArgument= DataTable in your case, in my case String
output= get_outDT in your case, PyScript_OutputString in my case
In my opinion your description looks very good. To your questions:
The Error loading Python script exception occurs in two cases, if the file can’t read or if something is wrong with the Python engine, e.g. wrong version. I tried the standard installation of both versions 3.8.6 x86 and x64 and my example works in both cases without any problems.
My example shows the transfer of one parameter, here an example with two parameters:
And here the code:
#-Begin-----------------------------------------------------------------
#-Includes--------------------------------------------------------------
import os
#-Function test---------------------------------------------------------
def test(scriptpath, anotherPar):
text_file = open(scriptpath + "\\Output.txt", "w")
text_file.write("Hello World from " + anotherPar)
text_file.close()
return "Hello World"
#-End-------------------------------------------------------------------