簡體   English   中英

盡管python代碼正確,但從nifi ExecuteScript處理器中獲取語法錯誤

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

盡管正確的 python 代碼不知道如何解決此錯誤,但我仍遇到以下錯誤。 任何幫助深表感謝

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

蟒蛇代碼

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