Greetings Community ,
I am working on a python scipt , which uses http post request to get data .
I have used invokehttp processor and worked hard to get data using it , but later figured out that there are some authentication libraries by the API developer . So I need to execute the specific python code provided by API developer to get data.
Now , I am trying to run the python code with some additional libraries .
I have taken reference of below link where in groovy additional libraries are hosted in local directory and path is mentioned in MODULE DIRECTORY in ExecuteScript Processor.
I am doing the same by specifiying the python libraries location (folder location) using comma separated
Tried forward and back slash as well while specifying folder location , even tried specifying the main python file ( __init.py__) but for all these attempts the error is as follows
No Module named xxx NOT FOUND in line XXX . Here is the what I mentioned in Module Directory in ExectuteScript Processor.
Answer by Matt Burgess · Jan 03 at 05:43 PM
When using the Jython script engine in ExecuteScript, the Module Directory property works somewhat like the standard Python module system. I believe you'll want to have the location(s) specified as the directories containing the scripts, not the scripts themselves. Each entry in Module Directory is added to the script engine via a "sys.path.append()" call, so if you can get the modules to load for a regular python script (using sys.path.append() with full path names), then you can use that same list for Module Directory. I'd try:
or whichever variations to avoid the drive letter, backslashes, etc.
In this unit test you can see the Module Directory set to a test resources folder, the test uses "from callbacks import ReadFirstLine", and there are .py files in the "callbacks" folder under the test resources folder specified as Module Directory. Hopefully you can use a similar approach to have the script engine find the folders/locations and import the corresponding code.