Load Python Script: One or more errors occurred

Yes, the version i’m using is 3.6.10

1 Like

Hi the simple test.py script works for my python enviromment.

The ‘text-summarizer.py’ script works independently without using UIPath. This script is actually from this here: Understand Text Summarization
So i think it is well tested to work

So i guess the issue is related around loading of Python Script in UIPath Studio…

1 Like

Hi @edang,

Have you tried to load this test.py in UiPath Studio (same project you were working on)?

Yes, I was able to load ‘test.py’ successfully in UIPath Studio. It runs ok too.

1 Like

Hi @edang,

Got it…

Now, let’s change our test.py file:

#!/usr/bin/env python
# coding: utf-8
import nltk
from nltk.corpus import stopwords
from nltk.cluster.util import cosine_distance
import numpy as np
import networkx as nx

def test():
 return 123

Then, test it again in same UiPath project as before, please.

Now, if it doesn’t load the script properly, we found where the error is going on… importing dependencies.

If my guess is confirmed, let me know and I’ll show you the next steps.


Hi Gustavo,
Haha :slight_smile: I faced the same error from UIPath Studio when I try to load the updated ‘test.py’

FYI I can run text-summarizer.py successfully using my python environment (without UIPath Studio use), so my python environment have the required python libraries

1 Like

Hi @edang,

So, your error is related to Python project dependences in UiPath Studio. Because if you run test.py using your Python environment it works. Also, if you delete import rows, test.py works in UiPath Studio too.

Let’s say this python project’s dependencies aren’t visible to your UiPath project.

Instead of copying your .py file from Python project and pasting it in your UiPathStudio, try to indicate .py original path. I mean, it’s located inside your Python project path. Example: C:/Users/Gustavo/PycharmProjects/TestProject/test.py

This can work because in that directory the environment is set and has everything you need to run.

Please, try it and let me know.

Hi Gustavo, no change…

i had actually placed both in the same folder:

  • UIPath script (which loads the python script)
  • ‘test.py’

In this folder:

  • With the right python environment containing necessary dependencies loaded in Pycharm, i was able to execute ‘test.py’ in this folder

I reduce the number of ‘imports’ in ‘test.py’ to just a single import to use a popular/widely used Numpy library. UIPath can’t load this simplified script…

1 Like

Hi @edang,

Got it :frowning:

I faced this same problem when I was working on a project which loads a .py file with “imports”, but honestly I can’t remember now how I solved it.

I remember I changed Windows environment variables, pointing “Path” variable to Python\ and Python\Scripts\ paths, as you can see in image below.

Perhaps, that’s what makes Python installed dependencies “visible” to UiPath projects.

Try this, please.

in your case, you’ll use C:\Users\edang\anaconda3\envs\mldds3\ and C:\Users\edang\anaconda3\envs\mldds3\Scripts\

Hi Gustavo, after adding to Windows enviroment variable path, no change… Same error

1 Like

This diagram shows the full exception error message

1 Like

Hi @edang,

I saw the exception. It’s about .py dependencies.

They need to be accessible to UiPath.

Try to open PyCharm > open terminal > go to your UiPath project folder > type pip show numpy.

Does it return something?

Hi Gustavo, Yes it does show:

1 Like

Hi edang,

I’m running out of ideas, sorry :frowning:

We would need to connect to try to solve this problem.

If you want, send me a private message.

Hi @edang

Could you double check the below?

The problem is related to incorrect setup of the Python environment.

Make sure the Python version used has all the required packages installed, the working folder is set to the folder that keeps all the resources that are used in the Python script using relative paths - to the working folder - and the script is referenced to the full path of the script in Load script.

A test that verifies that everything is set up right is to run the script from windows command prompt as “python.exe script.py” where script.py is the script used in the project.

1 Like

A bit of extra info here.

The Python activities are invoked regardless of context, using only the Windows environment variables. If, for some reason, a certain path is not set or if a certain Python package is only available in a certain environment (e.g. in the Miniconda console you used to install a certain version of Python), then the script execution will fail.

As a simple verification, you should be able to run the script using nothing but the Windows Command Prompt.

<path to python.exe> <path to script.py>

If that doesn’t work, the Python activities won’t, either. You will surely see an error message of what doesn’t work. Your Python dedicated consoles (like Pycharm or Anaconda) have a lot of internal setup already performed, which the UiPath activities simply don’t have a way to do.

In this particular case, the dependent library was not available outside of the Python environment, which is why the Load Python Script activity failed.


@edang, I had a similar problem. I solved it using the path of the python interpreter in the “Path” and “WorkingFolder” fields in the python Scope activity. For me, it was the path “C:\ProgramData\Anaconda3\envs\PY36_TF2” in the 2 fields.
Make sure it works for you
Sem título


thanks man, your solution worked for <3 I just added my python script path in WorkingFolder of Input Uipath and it was good

Have you tried with Anaconda? My python path works with C:\Users\User\Anaconda3

However I notice if I add an import library line in my main script after Load Script such as
“from ibm_watson import AssistantV1” I get an error. Even if script isn’t using any from that package, it werrors out. My environment has that package installed already as I see it in my “Anaconda3\Lib\site-packages”.

I am not sure if this is still an issue, but if yes, you may need to install the respective python packages that you import manually in the system you execute the process.

You can do this by executing below command in command prompt [as admin]
pip install

Once done, try running the XAML and python script should load fine. Try and let me know if this helps.