*Solved but unhappy* ArgumentNullException with LoadScript when importing in pyhon

Solved
I add sys.path.append(‘absolute-path-to-project’), now the interpreter/UiPath can find my class files.
However the code should be able to find the files just fine without, so I would like someone to explain what is going wrong.

Using UiPath Enterprise Edition 2018.2.6
Python Pack version 1.1.6863.33404

I want to run a python script with custom classes from UiPath. The script works on its own.
But UiPath throws an error when I try to import classes that I write myself.

File structure:

/project_root
|   Main.xaml
|
├─ /run_python
    __init__.py
    main.py
    config.py
    tools.py
 

Main.py

import logging.handlers
import sys
from config import dev_config as c
from tools import valid_xlsx
#...

In UiPath:

UiPath.Python.Activities.LoadScript(“run_python\main.py”)

UiPath crashes on line 3 and 4 when running the script. For some reason UiPath can’t handle local classes.
billede

Maybe it time to upgrade to the latest version of UiPath?

Edit: doing that now

1 Like

I found the problem:
The attribute __file__ is None when UiPath runs. Should this be in a bug report?