简体   繁体   English

尽管python代码正确,但从nifi ExecuteScript处理器中获取语法错误

[英]getting syntax error from nifi ExecuteScript processor inspite of correct python code

I am getting below error inspite of correct python code don't know how to resolve this error.尽管正确的 python 代码不知道如何解决此错误,但我仍遇到以下错误。 Any help is much appreciated任何帮助深表感谢

org.apache.nifi.processor.exception.ProcessException: javax.script.ScriptException: SyntaxError: no viable alternative at input '*' in <script> at line number 35 at column number 26

python code蟒蛇代码

def get_match_list(regEx, line):
    match = re.search(regEx, line)
    print(match)
    if match:
        match_list = [*match.groups()] # this is the line exception is pointed
        return match_list
    else:
        return []

看起来 jython使用python 2.7 并且因为Unpacking Generalizations是 python 3.5 中引入的一个特性,你不能在 jython 中使用这个语法,所以将元组转换为列表的另一种方法是使用list ( match.groups)它可以工作在旧版本的 python 和当前版本的 jython (2.7.2) 中很好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM