[
https://issues.apache.org/jira/browse/NIFI-8615?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17376069#comment-17376069
]
Matt Burgess commented on NIFI-8615:
------------------------------------
There have been number of improvements/fixes to Jython scripting between 1.13.2
and the upcoming 1.14.0 release, when 1.14.0 is released please try with that
and if fixed, we can close this as Overcome By Events.
> 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
> Priority: Major
> Labels: Debian
> 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)