Error trying to run python script

Hello, I am trying to generate a word document through a python script that is executed in electroneek but it generates the following error

The script works correctly if I run it with a framework like vscode. In the virtual env folder I already have the library installed, however electroneek tells me in the error that it cannot find it

Does anyone know why the error?

1 Like

Hi @Oscar_Gonzalez ,

Seems like you have a problem in the configuration. Have you installed Python and added the Python to the PATH system variable as described in the requirements?

Also check that you have set up a venv folder correctly:

  1. python -m virtualenv "C:\PythonEnv_ElectroNeek"
  2. "C:\PythonEnv_ElectroNeek\Scripts\activate"
  3. pip install docxtpl

You can try to use the next project as an example as it works correct - PythonTest.zip (2.5 KB)

When I type pip list on venv folder this is the result

This is my path on electroneek
image

and type pip list on the same

Hey @Oscar_Gonzalez,

The result of pip list will be the same in any other folder if you are not using virtual environment when running it.

The command to check the list with a venv should be:
(Virtual Environment Name) C:\PythonEnv> pip list.

The command you can execute to test each venv is the following:
To activate Venv (the example provided above) : "C:\PythonEnv_ElectroNeek\Scripts\activate".
To activate Venv (your case): "C:\PythonEnv\Scripts\activate".
Then you can run pip list an expect different results.

Previously I also sent the requirements for the ‘Execute Python’ activity and how to set up a new venv folder correctly, please review it.

Now Electroneek recognizes the library but apparently Pandas gives an error regarding the path of the Excel file. I use an excel file from which I extract the information that the script will use to generate the word documents, in vscode it works and I have the file in the same folder where the script that executes the electroneek bot is located

Following your advice, I read the eletroneek documentation and changed the electroneek path to the virtual environment, which solved the library problem.

[image]

1 Like

Problem solved,

  1. First you need to set the path within the folder where venv is installed.
  2. The paths in the script should be like the path inside the electroneek by escaping / with double //