0
我一直試圖在NiFi的ExecuteScript處理器中運行python腳本。雖然這裏的問題是我沒有服務器文件位置訪問權限,並且所有的python庫都安裝在「/ data/jython」,「/ data/jython/Lib/site-packages /」和「data/nltk」無法從Nifi ExecuteScript處理器中引用python庫
下面是我的python腳本的進口部分:
import json, traceback, pycountry, requests, geocoder, re, sys, nltk
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from nltk.corpus import stopwords
from java.nio.charset import StandardCharsets
from org.apache.commons.io import IOUtils
from org.apache.nifi.processor.io import StreamCallback
from org.python.core.util import StringUtil
有什麼我失蹤?我提到了另一個回答here,但無法弄清楚我的代碼有什麼問題。
我嘗試使用sys.path.append()添加庫路徑。還嘗試添加路徑到模塊目錄,但它不起作用。 – atulshgl
正如@Andy上面所說,你使用的一些模塊使用本地編譯的代碼。看到mattyb的答案[這裏](https://stackoverflow.com/questions/40719469/import-modules-in-nifi-executescript/40722026#40722026) –