2

it happens when I run python job in ExecuteScript processor.

enter image description here

I have search for answer for many times ,but can't find a solution which does work.

a answer said that I should add the code like this to include my external python lib , I try it but error still exist .

import sys
sys.path.append('/usr/lib64/python2.7/site-packages')

also I add the module property in processor . but it still doesn't work.

enter image description here

daggett
  • 26,404
  • 3
  • 40
  • 56
FakerWang
  • 51
  • 2
  • 5

2 Answers2

1

My understanding is that you don't need to import sys in your Python scripts when you use the ExecuteScript processor: this is done implicitly for you. Also, since you have defined the Module Directory property in the processor configuration you don't need to add that to your path within the script.

We can't see any more of your script that the first line and a half. Presumably you have an import six or import X from six on line 4.

The error is saying that it cannot find a module named six in the module directory, so possible reasons are:

  • the library genuinely isn't present in that folder
  • you have copied in a library for the wrong version of python (jython)
  • NiFi doesn't have permission to read the library (how did you copy it there?)

There are other questions here on SO relating to problems loading python libraries, such as:

Charlie Joynt
  • 4,411
  • 1
  • 24
  • 46
0

I'm still working through this problem, but I've found that the working directory in our nifi setup is always this: /usr/hdf/3.3.1.0-10/nifi

No matter what the module directory is set to.

jlansey
  • 3,996
  • 2
  • 17
  • 15