Support Questions
Find answers, ask questions, and share your expertise
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

No viable alternative at input '' .


No viable alternative at input '' .


I am trying to read zip file in nifi execute processor and I am using python as a scripting language. When I run the script it throws no viable alternative input at line 25 (flowFile = session.get()). What is the real cause behind this.

Here is my script

from zipfile import ZipFile
from import InputStreamCallback
import json
from import IOUtils
from java.nio.charset import StandardCharsets
from import StreamCallback 
class ReadVersion(InputStreamCallback):
  def __init__(self):
    self.flowFile = None
    self.version = ''
    self.error = ''
  def process(self,inputStream):
      zipname = self.flowFile.getAttribute('filename')
      zippath = self.flowFile.getAttribute('absolute.path')
      zfile = zipfile.ZipFile(zippath+zipname)
      with zipFile(zfile,'r') as zip:
        pageview ='pageview.json').decode("utf-8")
        pageview = json.loads(clients)
        pam ='pam.json') 
        pam= json.loads(Company.decode("utf-8") ) 

flowFile = session.get()
if (flowFile != None):
  callback = ReadVersion()
  callback.flowFile = flowFile, callback)
  if (callback.version != ''):
    flowFile = session.putAttribute(flowFile,'MSVersion',callback.version)
    session.transfer(flowFile, REL_SUCCESS)
  if (callback.error == 'error'):
    session.transfer(ff, REL_FAILURE)

Re: No viable alternative at input '' .

@Vivek Singh

Try this instead,

def flowFile = session.get(1)
Don't have an account?
Coming from Hortonworks? Activate your account here