We might sometimes think of writing python scripts to automate few tasks or to achieve some desired results.
let’s see how to do that…!!!
Mandatory: UiPath.Python.Activities package
Example
Implementation using UiPath :
Let us implement a workflow which takes name and country and displays a proper welcome message using a python script.
Step 1:
Drag “Python Scope” activity into the designer panel and set the required parameters.
Path:
Your python installed path i.e. “C:\Users\sharathm\AppData\Local\Programs\Python\Python36”
Version:
Select your current version .i.e 3.6,3.5,2.7…
Step 2:
Drag “Load Python Script” activity into the designer panel to load the python script and supply the below parameters.
File: Your python script path
Result: Create a PythonObject type variable and pass it here
Our Python Script:
Load Python Script Activity:
Step 3:
Drag “Invoke Python Method” activity into the designer panel and supply the function name that we want to invoke with the required arguments to it.
Function Name: Welcome
Here we have used two arguments i.e
Name: Sharath
Country: India
Step 4:
Drag “Get Python Object” activity into the designer panel to convert the python Object obtained from the above activity to our desired datatype (In our case its “string” type)
Step 4:
Drag “Message Box” activity to display the welcome message obtained from the script.
Step 5:
Finally, execute the workflow 🙂
Click here to download the Source Code…
Hope it has helped you…
install your source code and get error –> Load Python Script: Error loading Python script. 🙁
No worries
So, which version of python are you using currently?