i am planning to write python code in executescript processor. As this is my first time, i am finding difficult to start.
basically, i want to read flowfile (csv) and do some manipulation and write it to flowfile.
is there a way where we can write the code beforehand, say suppose jupyter and then replicate the same in the processor?
also, is there any syntax documentation for writing the code?
EXECUTESTREAMCOMMAND:
import org.apache.commons.io.IOUtils
import java.io
import csv
# Get flowFile Session
flowFile = session.get()
# Open data.json file and parse json values
readFile = csv.reader(sys.stdin)
for row in readFile:
new_value = row[0]
if (flowFile != None):
flowFile = session.putAttribute(flowFile, "from_python_string", "python string example")
flowFile = session.putAttribute(flowFile, "from_python_number", str(new_value))
session.transfer(flowFile, REL_SUCCESS)
session.commit()
Command Arguments: C:\Users\Desktop\samp1.py
Command Path: C:\Users\AppData\Local\Programs\Python\Python37-32\python
when i execute it, it throws error on the import statement saying no module found.
tia