# Load Python Script error when running python script

**URL:** <https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446>\
**Category:** Studio\
**Tags:** python, error, activities\
**Created:** [March 6, 2020, 10:47am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446 "2020-03-06T10:47:38Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![sudhasagar](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudhasagar/32/97359_2.png) [@sudhasagar](https://forum.uipath.com/u/sudhasagar)\
**Post date:** [March 6, 2020, 10:47am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/1 "2020-03-06T10:47:38Z")

</div>

Hi All,

I need to extract the content of data from website.

 ![image](https://global.discourse-cdn.com/uipath/original/3X/0/1/019a8452d1113a3ce7d360642af6cd995a676b19.png)

I said to python developer, that i required like this way and he made it below csv.

![image](https://global.discourse-cdn.com/uipath/original/3X/d/7/d7669237b30335cca3444da7e8fc9d0a2e97f477.png)

when i load my script file, it throws the error

This is my script below  
 ![image](https://global.discourse-cdn.com/uipath/original/3X/d/7/d7f6a8ba520ded28b0deadb59666323e6becb278.png)

So, i’m attaching my file please check and make corrections  
[pythonProcess.zip](https://forum.uipath.com/uploads/short-url/aJdbHR8LjFB8HU43uHVJStPScq7.zip) (1.9 KB)

@Palaniyappan  
@Rahul_Pasupuleti

---

<div class="post-metadata">

**Author:** ![msan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/msan/32/110167_2.png) [@msan](https://forum.uipath.com/u/msan)\
**Post date:** [March 6, 2020, 10:58am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/2 "2020-03-06T10:58:18Z")

</div>

@sudhasagar

What is the error?

---

<div class="post-metadata">

**Author:** ![sudhasagar](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudhasagar/32/97359_2.png) [@sudhasagar](https://forum.uipath.com/u/sudhasagar)\
**Post date:** [March 6, 2020, 11:05am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/3 "2020-03-06T11:05:53Z")

</div>

![image](https://global.discourse-cdn.com/uipath/original/3X/3/b/3b396c0ccb1026f0584d01ab41755c67d67128e6.png)

---

<div class="post-metadata">

**Author:** ![msan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/msan/32/110167_2.png) [@msan](https://forum.uipath.com/u/msan)\
**Post date:** [March 6, 2020, 11:09am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/4 "2020-03-06T11:09:25Z")

</div>

@sudhasagar  
Could you please display the details too? It’s already quite painful to have a proper python traceback from UiPath 🙂

---

<div class="post-metadata">

**Author:** ![sudhasagar](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudhasagar/32/97359_2.png) [@sudhasagar](https://forum.uipath.com/u/sudhasagar)\
**Post date:** [March 6, 2020, 11:15am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/5 "2020-03-06T11:15:02Z")

</div>

Project Details?? or script details

---

<div class="post-metadata">

**Author:** ![msan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/msan/32/110167_2.png) [@msan](https://forum.uipath.com/u/msan)\
**Post date:** [March 6, 2020, 12:46pm UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/6 "2020-03-06T12:46:08Z")

</div>

@sudhasagar  
The error details.

Did you also try to run the script by itself out of UiPath but in the same environment?

---

<div class="post-metadata">

**Author:** ![Palaniyappan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/palaniyappan/32/524095_2.png) [@Palaniyappan](https://forum.uipath.com/u/Palaniyappan)\
**Post date:** [March 7, 2020, 1:57am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/7 "2020-03-07T01:57:14Z")

</div>

Hi  
It’s been long time  
Hope you are doing well  
Did we try run the key thing script as a bat file  
That is create a bat file and mention the filepath of python.exe and the script file path  
And here in uipath use START PROCESS activity and pass the filepath of bat file as input to FileName property

And also make sure that the python code is executed manually from the shell first and it’s getting executed as expected

Cheers @sudhasagar

---

<div class="post-metadata">

**Author:** ![sudhasagar](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudhasagar/32/97359_2.png) [@sudhasagar](https://forum.uipath.com/u/sudhasagar)\
**Post date:** [March 9, 2020, 6:21am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/8 "2020-03-09T06:21:55Z")

</div>

Not in same Environment,but worked in another one

---

<div class="post-metadata">

**Author:** ![sudhasagar](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudhasagar/32/97359_2.png) [@sudhasagar](https://forum.uipath.com/u/sudhasagar)\
**Post date:** [March 9, 2020, 6:26am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/9 "2020-03-09T06:26:26Z")

</div>

Hi  
Thanks for remembering me.  
Yes, i’m doing well  
The script is worked in different environment(some other laptop) and it worked.  
I really dont have idea, Can u please check my workflow, is that process is correct or not?

---

<div class="post-metadata">

**Author:** ![sudhasagar](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudhasagar/32/97359_2.png) [@sudhasagar](https://forum.uipath.com/u/sudhasagar)\
**Post date:** [March 13, 2020, 4:30am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/10 "2020-03-13T04:30:28Z")

</div>

Hi,

I found the solution, using python script.  
There are some changes in script, that i made according to uipath output

---

<div class="post-metadata">

**Author:** ![lvdanyang06](https://avatars.discourse-cdn.com/v4/letter/l/e36b37/32.png) [@lvdanyang06](https://forum.uipath.com/u/lvdanyang06)\
**Post date:** [June 12, 2020, 3:20am UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/11 "2020-06-12T03:20:10Z")

</div>

Would you please show the way to me? How did you resolve the issue? I met the same one.

---

<div class="post-metadata">

**Author:** ![sudhasagar](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudhasagar/32/97359_2.png) [@sudhasagar](https://forum.uipath.com/u/sudhasagar)\
**Post date:** [June 14, 2020, 12:47pm UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/12 "2020-06-14T12:47:58Z")

</div>

Hi,

First, install pre-requirements for python and run the code using python. I sat with python-dev and said the requirements. He checks and invoked the python in UIpath. The output i said to bring as csv file.  
Mainly he changed the python code as per Uipath. There are steps to be followed in the python code. Then it works.  
I’m Sharing my workflow, Pls go throw  
[DHL .xaml](https://forum.uipath.com/uploads/short-url/nwvvLxpbqLn9xuzEusFagYzjoeD.xaml) (21.2 KB)

---

<div class="post-metadata">

**Author:** ![sudhasagar](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/sudhasagar/32/97359_2.png) [@sudhasagar](https://forum.uipath.com/u/sudhasagar)\
**Post date:** [June 14, 2020, 12:54pm UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/13 "2020-06-14T12:54:37Z")

</div>

> [@How to run pyhton script in uipath](https://forum.uipath.com/t/how-to-run-pyhton-script-in-uipath/125745/20):
>
> Hi Divya, I have gone through the code and script. You cannot directly run a python script through UiPath. It isn’t a reliable approach or a stable approach to follow. Python script: The script has to be in form of a function. Example : def(a,b): return(a+b) I have transformed your script into a function. It requires two inputs. Inp PDF file and Op Excel file. Pass them in the UiPath program and it’ll run. Also, make sure you have the necessary libraries installed. Inside Python Scope…

Pls go throw this person, gives lots of information related to py scripthing. I shared to my python dev and he understanding the way of invoking python script in UI.

---

<div class="post-metadata">

**Author:** ![mircea](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/mircea/32/196794_2.png) [@mircea](https://forum.uipath.com/u/mircea)\
**Post date:** [October 16, 2020, 9:09pm UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/14 "2020-10-16T21:09:15Z")

</div>

A fix was pushed for Error when Invoking Python Script. See the fix here: [Python.Activities: Fix threading model for load/execute script by florinakke · Pull Request #69 · UiPath/Community.Activities · GitHub](https://github.com/UiPath/Community.Activities/pull/69)

Deployed fix with UiPath.Python.Activities version v1.1.7594.35963 on Connect feed.

Please test if this fixes your problem as well.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/system/32/182466_2.png) [@system](https://forum.uipath.com/u/system)\
**Post date:** [October 19, 2020, 9:09pm UTC](https://forum.uipath.com/t/load-python-script-error-when-running-python-script/200446/15 "2020-10-19T21:09:29Z")

</div>

Closed on October 19, 2020, 9:09pm UTC

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