How to run a python script with entering arguments

I need to now hoy to run a program call ‘osaki.py’ with 5 arguments (entering).

I have read, but i could not be able to run it.

Any one knows?

@amaia.aristeguii

You just need to pass them as a list

{var1,var2,var3..}

Cheers

1 Like

but how can run the osaki.py ? with method? how can i fill it?

not working what you have menthioned

Check this example for a Windows project with VB language.

  1. In the Studio machine install Python 3.10.10 64-bit from here https://www.python.org/ftp/python/3.10.10/python-3.10.10-amd64.exe . After installing it, you need to restart the machine.

  2. In the Studio machine, for Windows projects, the Python Scope activity requires you to install the .NET Desktop Runtime 5.0.17. After installing it, you need to restart the machine.

  3. In your project add the UiPath.Python.Activities[1.6.0] package.

  4. Add a Python Scope activity and configure it as below (modify the values with your installation path):

Library path: "C:\Users\your_username\AppData\Local\Programs\Python\Python310\python310.dll"

Path: "C:\Users\your_username\AppData\Local\Programs\Python\Python310"

Target: x64

Version: Python >=3.10

  1. Create a python script with name MathOperations.py that will have this content:
def add(num1,num2):
	return num1 + num2
	
def dif(num1,num2):
	return num1 - num2
  1. Add a Load Python Script activity and configure it as below:

File: "MathOperations.py"

Result: pyScriptOut (create a variable with Ctrl + k)

  1. Add an Invoke Python Method activity and configure it as below:

InputParameters: Array.ConvertAll({5,4}, Function(x) CType(x, Object))

Instance: pyScriptOut

Name: "add"

Result: pyOutput (create a variable with Ctrl + k)

  1. Add a Get Python Object activity and configure it as below:

PythonOject: pyOutput

TypeArgument: Int32

Name: “add”

Result: addOperationOutput (create a variable with Ctrl + k)

  1. Add a Log Message activity and configure it as below:

LogLevel: LogLevel.Info

Message: addOperationOutput

  1. In the Variables panel check if the variables have the correct type:

  1. If you will run the file, the result will be 9.

image

i am using ‘INVOKE PROCESS’

and i got this error:

Check the solution from here I Want to see the python output in UiPath - #2 by jack.chan

1 Like

Hi @marian.platonov
Sorry didn’t mean to hijack this thread but it seems these steps are relevant to solving my issue right now where i have a python script that runs on a conda environment with python version 3.10.11, and I’m also using Python.Activities package v1.6.0.
However I’m encountering below error on the python scope. Any thoughts on this? Is it because I’m using anaconda to create the python environment?
image
image