Run Python Script help

Hi All,

I want to run a very simple python script that creates a txt file called hello. my python code is bellow…
image

Ive used a Python Scope with path “C:/python36” and set the version and target appropriately.
In the run python activity ive included the path of the python script.

The python script works fine when I run it manually. However when i run it with uipath I dont get any errors but the file isnt created.

Any help would be great,
Regards.

Try this example I put together to help troubleshoot:

Hi @cody.barber

There are two options to do this
Either we can use python activities like install uipath.python.activities in manage packages option in the design tab in studio
Once after installing use RUN PYTHON SCRIPT activity inside a PYTHON SCOPE ACTIVITY

docs.uipath.com

Run Python Script

UiPath.Python.Activities.RunScript Enables you to execute Python code. You can input the code directly in the activity or provide a file path for it. Can only be used inside the Python Scope activity. Due to a software limitation, this…

Or

We can use a .bat file to execute
Like
“Your python.exe file path” “your main.xaml file path”

Use a notepad and mention the above expression and save as .bat file

Then use START PROCESS activity and mention that .bat file path as input
This will execute that file and creates the file

Ensure that the file path mentioned in the python script is correct and we are checking with correct file path as well.

Thanks
Latika

Hi,

Thanks @Latika10011740. This was very helpful. I’ve also found out that you can just use a send hotkey activity and send a “win + r” and then a type into activity and type the file path and that works fine for what i want.

1 Like