# Error when using "Load python script activity"

**URL:** <https://forum.uipath.com/t/error-when-using-load-python-script-activity/75611>\
**Category:** Help\
**Tags:** python, activities\
**Created:** [November 12, 2018, 8:14am UTC](https://forum.uipath.com/t/error-when-using-load-python-script-activity/75611 "2018-11-12T08:14:38Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![JANI\_PASHA](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/jani_pasha/32/60439_2.png) [@JANI\_PASHA](https://forum.uipath.com/u/JANI_PASHA)\
**Post date:** [April 18, 2019, 11:23am UTC](https://forum.uipath.com/t/error-when-using-load-python-script-activity/75611/23 "2019-04-18T11:23:50Z")

</div>

Still having load python script error.  
Can you define the standard way to configure this activity.

---

<div class="post-metadata">

**Author:** ![tome.lourenco](https://avatars.discourse-cdn.com/v4/letter/t/cab0a1/32.png) [@tome.lourenco](https://forum.uipath.com/u/tome.lourenco)\
**Post date:** [June 24, 2019, 3:51pm UTC](https://forum.uipath.com/t/error-when-using-load-python-script-activity/75611/24 "2019-06-24T15:51:27Z")

</div>

Hi Padegal,

It seems the reason is behind where the python code is executed and therefore unable to locate the file. My own workaround on this is to pass the path of the file as an argument, therefore you can define it as a variable the uipath env.

---

<div class="post-metadata">

**Author:** ![burque505](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/burque505/32/177718_2.png) [@burque505](https://forum.uipath.com/u/burque505)\
**Post date:** [June 26, 2019, 10:55pm UTC](https://forum.uipath.com/t/error-when-using-load-python-script-activity/75611/25 "2019-06-26T22:55:48Z")

</div>

@tome.lourenco, welcome and thank you for posting. I am having a similar issue which I haven’t resolved yet. Somewhere in the forum I found this code:

```
import sys 
import os
sys.path.append(os.path.dirname(os.path.realpath( __file__ )))

```

which the post said to put just before the “import your-module-here” call. The reason given was that the software restriction in place make UiPath look for the py script in the activities directory. I will try your workaround as well. See e.g. [this post](https://forum.uipath.com/t/documentation-bug-for-python-activities/109708), [this one that says Python 3.7 won’t work (seems doubtful now)](https://forum.uipath.com/t/python-activity-error/53409/83). I am certainly hoping Python 3.7 will work . . .

EDIT: Just in case 3.7 won’t work, and perhaps that’s so, I installed Python 3.6 in a virtualenv and pointed the workflow above (CultivationFacilityScoreBreakdown) to that version of Python. I didn’t get any path errors, but I did get this:

 ![python%20woes](https://global.discourse-cdn.com/uipath/original/3X/f/a/fa55ad59c03122e47dde283fe2bc880beb7a7325.png)  
Regards,  
burque505

---

<div class="post-metadata">

**Author:** ![ronanpeter](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ronanpeter/32/176941_2.png) [@ronanpeter](https://forum.uipath.com/u/ronanpeter)\
**Post date:** [June 27, 2019, 8:42am UTC](https://forum.uipath.com/t/error-when-using-load-python-script-activity/75611/26 "2019-06-27T08:42:05Z")

</div>

This may or may not help, but it is a working version of invoking a python script. The script is based on a pluralsight course exercise which creates aircraft objects which have various methods, including the airline name which I access in this UiPath workflow. The answer in this case is ‘BA’. The aircraft object is created in the py script using the make\_flight function so you don’t need to worry about that here.

It is set up so that you just have to provide your path to the python\_36 executable file so that it can be read by the scope.

[InvokePython.zip](https://forum.uipath.com/uploads/short-url/8uwyUsnNXimmiAuqKrl9Vp9jWwS.zip) (3.1 KB)

---

<div class="post-metadata">

**Author:** ![burque505](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/burque505/32/177718_2.png) [@burque505](https://forum.uipath.com/u/burque505)\
**Post date:** [June 27, 2019, 4:58pm UTC](https://forum.uipath.com/t/error-when-using-load-python-script-activity/75611/27 "2019-06-27T16:58:56Z")

</div>

@ronanpeter, thank you! That worked perfectly when I used a 64-bit version of Python 3.6. Just in case anyone else tries it with 32-bit, for me at least it crashed UiPath.  
Greatly appreciated! If I can figure out how to mark my issue just above as “solved” due to your post I will. Please bear with me.  
Regards,  
burque505

---

<div class="post-metadata">

**Author:** ![burque505](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/burque505/32/177718_2.png) [@burque505](https://forum.uipath.com/u/burque505)\
**Post date:** [June 27, 2019, 5:05pm UTC](https://forum.uipath.com/t/error-when-using-load-python-script-activity/75611/28 "2019-06-27T17:05:50Z")

</div>

On my machine at least the solution given by @ronanpeter, with a working workflow attached, solved it for me. Please see below my post for his solution. I did not need to use a virtualenv for it, I just pointed my script to where Python 3.6 resides, i.e. C:\Python36\ (just the folder name, not the executable).

 ![python%20woes](https://global.discourse-cdn.com/uipath/original/3X/f/a/fa55ad59c03122e47dde283fe2bc880beb7a7325.png)

Regards,  
burque505

---

<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:** [June 30, 2019, 5:15pm UTC](https://forum.uipath.com/t/error-when-using-load-python-script-activity/75611/29 "2019-06-30T17:15:54Z")

</div>

Closed on June 30, 2019, 5:15pm UTC

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

[Previous page](https://forum.uipath.com/t/error-when-using-load-python-script-activity/75611.md?page=1)
