# Python activity error

**URL:** <https://forum.uipath.com/t/python-activity-error/53409>\
**Category:** Help\
**Tags:** python, activities\
**Created:** [July 23, 2018, 10:44am UTC](https://forum.uipath.com/t/python-activity-error/53409 "2018-07-23T10:44:19Z")\
**Posts on this page:** 20\
**Page:** 4

<div class="post-metadata">

**Author:** ![Gabriel\_Tatu](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/gabriel_tatu/32/13772_2.png) [@Gabriel\_Tatu](https://forum.uipath.com/u/Gabriel_Tatu)\
**Post date:** [October 17, 2018, 2:05pm UTC](https://forum.uipath.com/t/python-activity-error/53409/61 "2018-10-17T14:05:50Z")

</div>

its out, check Official feed

---

<div class="post-metadata">

**Author:** ![rautry](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rautry](https://forum.uipath.com/u/rautry)\
**Post date:** [October 17, 2018, 2:17pm UTC](https://forum.uipath.com/t/python-activity-error/53409/62 "2018-10-17T14:17:35Z")

</div>

I just installed a virtual environment in exactly the same way, pip installed pandas to the new environment, set the Python directory in UiPath to it, and my script ran without error (just importing pandas, datetime and os).

Did you activate the environment?

i.e. (the name of my environment is py36)

```
conda activate py36

```

You can disregard the references to Python 3.7 in conda info, I have the same thing:

 ![condaInfo](https://global.discourse-cdn.com/uipath/original/3X/3/8/38b917ee05836d2f4ac96871b18c1c2c0b873b31.png)

Additionally, make sure the packages are installed:

```
conda list

```

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

---

<div class="post-metadata">

**Author:** ![Mayur\_Pande](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mayur\_Pande](https://forum.uipath.com/u/Mayur_Pande)\
**Post date:** [October 17, 2018, 2:19pm UTC](https://forum.uipath.com/t/python-activity-error/53409/63 "2018-10-17T14:19:55Z")

</div>

Yes activated the environment, it is all correct. Do I need to activate it from the python scope activity? Should I use pip to install instead of conda?

---

<div class="post-metadata">

**Author:** ![rautry](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rautry](https://forum.uipath.com/u/rautry)\
**Post date:** [October 17, 2018, 2:21pm UTC](https://forum.uipath.com/t/python-activity-error/53409/65 "2018-10-17T14:21:44Z")

</div>

I’m not sure if it makes a difference for installing packages, but I did pip install pandas from the Anaconda Prompt

---

<div class="post-metadata">

**Author:** ![Mayur\_Pande](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mayur\_Pande](https://forum.uipath.com/u/Mayur_Pande)\
**Post date:** [October 17, 2018, 2:50pm UTC](https://forum.uipath.com/t/python-activity-error/53409/66 "2018-10-17T14:50:04Z")

</div>

wow it finally works, so it needed to be installed with pip not conda, very odd. Maybe the update done something as well.

But massive thank you 100x @rautry you have been a great help, without you I would still be opening conda prompt. Have a good day! 😀

---

<div class="post-metadata">

**Author:** ![rautry](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rautry](https://forum.uipath.com/u/rautry)\
**Post date:** [October 17, 2018, 3:00pm UTC](https://forum.uipath.com/t/python-activity-error/53409/67 "2018-10-17T15:00:09Z")

</div>

Glad we got to the bottom of this! Good to know that the python environments can be a little tricky with conda and then UiPath.

Have a good one!

---

<div class="post-metadata">

**Author:** ![Mayur\_Pande](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mayur\_Pande](https://forum.uipath.com/u/Mayur_Pande)\
**Post date:** [October 22, 2018, 11:10am UTC](https://forum.uipath.com/t/python-activity-error/53409/68 "2018-10-22T11:10:48Z")

</div>

arghhh this is so annoying I haven’t done anything since Friday, and now the script won’t load. But it was working fine before hand.

---

<div class="post-metadata">

**Author:** ![rautry](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rautry](https://forum.uipath.com/u/rautry)\
**Post date:** [October 22, 2018, 11:54am UTC](https://forum.uipath.com/t/python-activity-error/53409/69 "2018-10-22T11:54:06Z")

</div>

If you are getting an error about the script, you probably need to check your paths. If you are using all static paths, you’ll need to double-check that everything is still in the same location.

---

<div class="post-metadata">

**Author:** ![Mayur\_Pande](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mayur\_Pande](https://forum.uipath.com/u/Mayur_Pande)\
**Post date:** [October 23, 2018, 10:25am UTC](https://forum.uipath.com/t/python-activity-error/53409/70 "2018-10-23T10:25:25Z")

</div>

yes its something to do with paths again, but all my paths are absolute I have checked every one. I have been reading the docs and it told me to put this code in module;

```auto
import sys 
import os
sys.path.append(os.path.dirname(os.path.realpath(_file_)))
import <your module here>

```

But that doesn’t work too. It is really odd that this worked fine on Friday.

---

<div class="post-metadata">

**Author:** ![Mayur\_Pande](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mayur\_Pande](https://forum.uipath.com/u/Mayur_Pande)\
**Post date:** [October 23, 2018, 10:27am UTC](https://forum.uipath.com/t/python-activity-error/53409/71 "2018-10-23T10:27:45Z")

</div>

I also asked elsewhere with python developers and they said sys.path should not be changed.

---

<div class="post-metadata">

**Author:** ![Mayur\_Pande](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mayur\_Pande](https://forum.uipath.com/u/Mayur_Pande)\
**Post date:** [October 23, 2018, 2:57pm UTC](https://forum.uipath.com/t/python-activity-error/53409/72 "2018-10-23T14:57:39Z")

</div>

Found the error it doesn’t like a special character from the Spanish language, which again is odd as one why was it working on Friday, two `read_excel` doesn’t mess up when running on its own.

---

<div class="post-metadata">

**Author:** ![rautry](https://avatars.discourse-cdn.com/v4/letter/r/9f8e36/32.png) [@rautry](https://forum.uipath.com/u/rautry)\
**Post date:** [October 23, 2018, 7:04pm UTC](https://forum.uipath.com/t/python-activity-error/53409/73 "2018-10-23T19:04:24Z")

</div>

Glad you figured it out!

---

<div class="post-metadata">

**Author:** ![ashoks93](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/ashoks93/32/176686_2.png) [@ashoks93](https://forum.uipath.com/u/ashoks93)\
**Post date:** [November 10, 2018, 3:18am UTC](https://forum.uipath.com/t/python-activity-error/53409/74 "2018-11-10T03:18:58Z")

</div>

Hi Mayur,

I’m going through similar issues. When I run a normal python script it’s perfectly running but when I use pandas or any other new module. UiPath is failing to execute the code. I would like to know how to setup environment.  
When you setting up path do you me providing python path in python scope ?

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

I have done that still I’m facing this issue. Also, I’m using run python script activity under python scope to execute the python script.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![Mayur\_Pande](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Mayur\_Pande](https://forum.uipath.com/u/Mayur_Pande)\
**Post date:** [November 10, 2018, 9:50am UTC](https://forum.uipath.com/t/python-activity-error/53409/75 "2018-11-10T09:50:46Z")

</div>

Hi @ashoks93,

It could be a number of things. I will list them and try each of them.

1. Do you have a virtual environment? If so provide the path to that. (It will be in the anaconda envs folder).
2. Are you using 32-bit or 64-bit python? Make sure to change the “Target” attribute to the correct one.
3. What version of python are you using, It cannot be python 3.7 it has to be 3.6, a friend of mine was using 2.7 and he could not use it with 64-bit so you might need to play around with what python version and target you are using.
4. Check your code for triple quoted comments and remove them.
5. Load python script using the “Load python” activity giving the path to the file name that you want to load. And then maybe just have a function that returns “hello world” → “invoke python method” activity give it the function name and o/p of the load python script → “get python object” activity convert the returned string to a .net string → “write line” activity to see if that works, then you know your path is correct it is something to do with the code.

Give those a go, and see if any of them fixes it. If not reply back and I will see what I can do.

---

<div class="post-metadata">

**Author:** ![pratosha.hegde](https://avatars.discourse-cdn.com/v4/letter/p/9d8465/32.png) [@pratosha.hegde](https://forum.uipath.com/u/pratosha.hegde)\
**Post date:** [December 11, 2018, 8:26am UTC](https://forum.uipath.com/t/python-activity-error/53409/76 "2018-12-11T08:26:57Z")

</div>

Hello ,  
I am trying to use 64 bit python-3.5.4 for my own activity, I have changed the target and version. I am using Uipath community edition 2018.4.0.  
The error I am facing is invalid Python path(no shortcut path added)  
What are the changes to be done?

---

<div class="post-metadata">

**Author:** ![vedantnarayan](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/vedantnarayan/32/127335_2.png) [@vedantnarayan](https://forum.uipath.com/u/vedantnarayan)\
**Post date:** [December 16, 2018, 12:14pm UTC](https://forum.uipath.com/t/python-activity-error/53409/77 "2018-12-16T12:14:10Z")

</div>

Hi ,

I have created a workflow by using instruction given in this thread. But getting the following error 👎

**System.IO.DirectoryNotFoundException: The specified Python path is not valid: ‪C:\Python35\python.exe**

1. I have python 3.5 32 bit version is already installed in the given path.

Please help.[RunPythonTest.zip](https://global.discourse-cdn.com/uipath/original/3X/d/9/d9e77e6fe3d3cdee249308cf57d7afd9847b6d12.zip) (10.5 KB)

---

<div class="post-metadata">

**Author:** ![Pawan\_Jha](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@Pawan\_Jha](https://forum.uipath.com/u/Pawan_Jha)\
**Post date:** [January 25, 2019, 10:27am UTC](https://forum.uipath.com/t/python-activity-error/53409/78 "2019-01-25T10:27:31Z")

</div>

getting error while executing python script

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

---

<div class="post-metadata">

**Author:** ![loginerror](https://sea2.discourse-cdn.com/uipath/user_avatar/forum.uipath.com/loginerror/32/22614_2.png) [@loginerror](https://forum.uipath.com/u/loginerror)\
**Post date:** [January 25, 2019, 2:56pm UTC](https://forum.uipath.com/t/python-activity-error/53409/79 "2019-01-25T14:56:45Z")

</div>

Hi @Pawan_Jha

Could you make sure that your argument is initialized?

Also, @vedantnarayan, if by any chance you still have the issue, see here:

> [@Python 64 bit compatibility with UiPath Studio 2018.4.0](https://forum.uipath.com/t/python-64-bit-compatibility-with-uipath-studio-2018-4-0/80767/6):
>
> hey @pratosha.hegde Just use this path and better to set Auto in version selection. C:\Users\hegdepra\AppData\Local\Programs\Python\Python35\ one thing - The Above path is not look good. Python installed on your system? if it is show it should be like C:\Python36\_64 or if you will have installed with Visual Studio then path will be like "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python36\_64" but if your python.exe is there exists that use that path how i mentioned above. Let…

---

<div class="post-metadata">

**Author:** ![Pawan\_Jha](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@Pawan\_Jha](https://forum.uipath.com/u/Pawan_Jha)\
**Post date:** [January 28, 2019, 5:11am UTC](https://forum.uipath.com/t/python-activity-error/53409/80 "2019-01-28T05:11:48Z")

</div>

> [@loginerror](#):
>
> C:\Program Files (x86)\Microsoft Visual Studio\Shared\

Thank you for you kind response, It’s working fine now.

---

<div class="post-metadata">

**Author:** ![prameelaj](https://avatars.discourse-cdn.com/v4/letter/p/90db22/32.png) [@prameelaj](https://forum.uipath.com/u/prameelaj)\
**Post date:** [January 29, 2019, 7:45pm UTC](https://forum.uipath.com/t/python-activity-error/53409/81 "2019-01-29T19:45:08Z")

</div>

How about 3.7 version? I am getting the same error. The path I defined here is C:\Users\PrameelaJanardanan\AppData\Local\Programs\Python\Python37-32\Python.exe.

[Previous page](https://forum.uipath.com/t/python-activity-error/53409.md?page=3)

[Next page](https://forum.uipath.com/t/python-activity-error/53409.md?page=5)
