Error when using "Load python script activity"

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

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.

@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, this one that says Python 3.7 won’t work (seems doubtful now). 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:


Regards,
burque505

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

1 Like

@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

1 Like

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).

Regards,
burque505

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