You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "Aldric DUPONT (Jira)" <ji...@apache.org> on 2021/05/18 13:54:00 UTC
[jira] [Created] (NIFI-8615) ExecuteScript with python when use
module directory
Aldric DUPONT created NIFI-8615:
-----------------------------------
Summary: ExecuteScript with python when use module directory
Key: NIFI-8615
URL: https://issues.apache.org/jira/browse/NIFI-8615
Project: Apache NiFi
Issue Type: Bug
Components: Extensions
Affects Versions: 1.13.2
Environment: debian linux
Reporter: Aldric DUPONT
Fix For: 1.12.1
Attachments: Capture2.PNG, Capture3.PNG, test_bug.xml
*I use additional module "pytz" in python, this module directory is locate in "/usr/local/lib/python3.9/site-packages"*
*I use sample1 in "Script Body" : (no comment)*
_from org.python.core.util.FileUtil import wrap_
_from org.apache.nifi.processors.script import ExecuteScript_
_from datetime import datetime, tzinfo_
_flow_file = session.get()_
_import pytz_
_from pytz import timezone_
_utc = pytz.utc_
_eastern = timezone('US/Eastern')_
_flow_file = session.putAttribute(flow_file, 'timezone', eastern.zone)_
_flow_file = session.putAttribute(flow_file, 'utc', utc.zone)_
_flow_file = session.putAttribute(flow_file, 'test', 'salut')_
_session.transfer(flow_file, ExecuteScript.REL_SUCCESS)_
*and sample2 with comment :* __
_from org.python.core.util.FileUtil import wrap_
_from org.apache.nifi.processors.script import ExecuteScript_
_from datetime import datetime, tzinfo_
_flow_file = session.get()_
_"""_
_import pytz_
_from pytz import timezone_
_utc = pytz.utc_
_eastern = timezone('US/Eastern')_
_flow_file = session.putAttribute(flow_file, 'timezone', eastern.zone)_
_flow_file = session.putAttribute(flow_file, 'utc', utc.zone)_
_"""_
_flow_file = session.putAttribute(flow_file, 'test', 'salut')_
_session.transfer(flow_file, ExecuteScript.REL_SUCCESS)_
+*Try 1*+
*When use sample1 in version 1.13.2 ExecuteScript make error " :*
{color:#ff8b00}_ERROR [Timer-Driven Process Thread-4] o.a.nifi.processors.script.ExecuteScript ExecuteScript[id=790ea9a2-0179-1000-a662-30042349b329] Failed to process session due to org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: ImportError: No module named pytz in <script> at line number 6: org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: ImportError: No module named pytz in <script> at line number 6_
_org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: ImportError: No module named pytz in <script> at line number 6_{color}
{color:#505f79}*with version 1.12.1 we have no error and I have output flowfile with new attribute*{color}
+*Try 2*+
*When use sample1 in version 1.13.2 ExecuteScript make error " :* **
{color:#ff8b00}_ERROR [Timer-Driven Process Thread-4] o.a.nifi.processors.script.ExecuteScript ExecuteScript[id=790ea9a2-0179-1000-a662-30042349b329] Failed to process session due to org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: ImportError: No module named pytz in <script> at line number 6: org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: ImportError: No module named pytz in <script> at line number 6_{color}
{color:#ff8b00}_org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: ImportError: No module named pytz in <script> at line number 6_{color}
*after I change Script boby with sample2 and nifi return the same error .... retry and the same ... ExecutreScript is bogue and we can't show the flowfile in queue.*
{color:#ff8b00}_ERROR [Timer-Driven Process Thread-4] o.a.nifi.processors.script.ExecuteScript ExecuteScript[id=790ea9a2-0179-1000-a662-30042349b329] Failed to process session due to org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: ImportError: No module named pytz in <script> at line number 6: org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: ImportError: No module named pytz in <script> at line number 6_{color}
{color:#ff8b00}_org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: ImportError: No module named pytz in <script> at line number 6_{color}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)