Python activity error

its out, check Official feed

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:

Additionally, make sure the packages are installed:

conda list

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?

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

1 Like

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! :grinning:

1 Like

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!

1 Like

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.

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.

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;

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.

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

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.

Glad you figured it out!

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 ?

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!

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.

1 Like

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?

Hi ,

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

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 (10.5 KB)

getting error while executing python script

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:

1 Like

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

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.