I was able to solve the python modules issues by adding the following lines:
import sys sys.path.append('/usr/local/lib/python2.7/site-packages') # Path where my modules are installed. Now the issue i have is , how do i parse the incoming attributes using this libarary correctly and get the new fields. I am kind of new to python and also this my first attempt of using python with nifi. Any help is appreciated. On Wed, Mar 23, 2016 at 11:31 PM, Madhukar Thota <madhukar.th...@gmail.com> wrote: > Hi > > I am trying to use the following script to parse http.headers.useragent > with python useragent module using ExecuteScript Processor. > > Script: > > #!/usr/bin/env python2.7 > from user_agents import parse > > flowFile = session.get() > if (flowFile != None): > flowFile = session.putAttribute(flowFile, "browser", > parse(flowFile.getAttribute('http.headers.User-Agent')).browser) > session.transfer(flowFile, REL_SUCCESS) > > > But ExecuteProcessor, complaining about missing python module but modules > are already installed using pip and tested outside nifi. How can i add or > reference this modules to nifi? > > Error: > > 23:28:03 EDT > ERROR > af354413-9866-4557-808a-7f3a84353597 > ExecuteScript[id=af354413-9866-4557-808a-7f3a84353597] Failed to process > session due to org.apache.nifi.processor.exception.ProcessException: > javax.script.ScriptException: ImportError: No module named user_agents in > <script> at line number 2: > org.apache.nifi.processor.exception.ProcessException: > javax.script.ScriptException: ImportError: No module named user_agents in > <script> at line number 2 > > > > >