How to run a python script in UiPath StudioX

Hi, I am new to UiPath StudioX, I have installed the Python.Activities Package in StudioX.
Now, I have to run a particular Python script, I watched some videos regarding that, but all were only using Studio and not StudioX, But I tried to accomplish the task using the available video, but when I run my project, I don’t get any output, or any errors too. It’s running indefinitely. I have given scope, python file, and everything correctly, but can’t figure out what I am doing wrong.
Any help would be appreciated.
Also, examples are most welcome.

Hi @Afsal_Baaqir_A ,
Can you share your wf ?
I think have a indefinitely loop
You can check that
Or you can add process stop method

Hello @Afsal_Baaqir_A, try this:

  1. Install Python.Activities Package: Make sure you have the “Python.Activities” package installed in your UiPath StudioX project. You can do this by going to the “Manage Packages” section in the Design tab and searching for “Python.Activities” to install it.
  2. Add Python Scope Activity:*Drag and drop the “Python Scope” activity onto your workflow canvas. This activity allows you to specify the Python environment in which the script will be executed.
  3. Configure Python Scope: Click on the “Python Scope” activity. In the Properties panel, under the “PythonPath” field, provide the path to your Python executable. This is usually located in the “Scripts” folder of your Python installation directory. For example, C:\Python39\Scripts\python.exe.
  4. Add Execute Python Script Activity: Inside the “Python Scope” activity, add the “Execute Python Script” activity. This is where you will write and execute your Python script.
  5. Write Python Script: In the “Execute Python Script” activity, click on the “Code” field to open the Python editor. Here, you can write your Python script.
  6. Run the Workflow: Save your workflow and run it by clicking the “Run” button. The Python script will be executed, and the output will be displayed in the Output panel at the bottom of the screen.

No, it’s not an indefinite loop, I checked this by using the write line activity. Even the first line is not executing.

Don’t need to specify the pythonxx.dll file??

following your instructions i get this error. I just copied the python.exe as path and pasted it there.

When you’re using the “Python.Activities” package in UiPath StudioX, you don’t need to explicitly specify the “pythonxx.dll” file. The package manages the interaction between UiPath and Python, so you primarily need to ensure that you provide the correct path to the Python executable (usually named “python.exe”).

In the provided steps, when you specify the PythonPath in the “Python Scope” activity, you’re providing the path to the Python executable (“python.exe”), not the DLL file. The package takes care of the interaction with the Python interpreter behind the scenes.

Try this to solve the error:

  1. Verify Python Installation Path: Double-check the path you provided in the “PythonPath” field of the “Python Scope” activity. Make sure it points to the correct location of the Python executable (python.exe). The typical installation path is something like “C:\Python39\python.exe,” but it could vary based on your installation.
  2. Use Absolute Path: Provide the complete and absolute path to the Python executable. For example, use “C:\Python39\python.exe” instead of a relative or incomplete path.
  3. Check Spaces and Special Characters: If your Python installation path contains spaces or special characters, ensure that you enclose the entire path in double quotes. For example, if your path is “C:\Program Files\Python39\python.exe,” use the path as: "C:\Program Files\Python39\python.exe".

Whole Path: “C:\Users\afsal\AppData\Local\Programs\Python\Python311\python.exe”

Hi, can you provide a simple example of adding two numbers problem, I will try by changing the scope of mine, maybe I’m missing something.
When I tried specifying the folder, I get a new error.

Hi, Thank you for your most valuable time, I solved the error by installing Python 3.9.
Maybe 3.11 is not supported by UiPath.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.

This a small message from the future :slight_smile:

A new version of the Python package 1.7.1 was released which supports Python 3.11 (you can grab it from the official feed).