Good afternoon. I have a python script that attempts to execute a stream
callback. I use re to extract content out of the incoming stream
represented as a string. After extracting the content I need, I save these
as attributes and attempt to write back my original content to the output
stream. It works almost all the time, but occasionally the ExecuteScript
processor hangs with the error message:
TypeErro: write(): 1st arg can't be coerced to byte[], int in script at
line number 184

I use an ExecuteScript with python as the ScriptEngine.
Line 184 in my script folds the call to the callback into a session.write,
like so:
flowFile = session.write(flowFile, PyStreamCallback())

In my callback method I catch the contents of my stream in a string, like
trailer = IOUtils.toString(inputStream,StandardCharsets.UTF_8)
I use re expressions to pattern match for nuggets I later save as

I use this to output back to my stream:
This almost always works, but fails on rare occasions because, well, I
don't think I'm smart enough to know how to bullet-proof the output stream

Can anyone show me how to modify this outputStream.write to overcome this
impediment? Bottom line: I simply want to send the inputStream back to the
outputStream at this point (I have saved all i parsed out to a python
dictionary accessible to me later in my script). If there's a better form
of the outputStream write I am using that directly references the input
stream, that may eliminate my impediment.

I am running on an older version of Apache NiFi, 0.7.x.

Thanks very much for any assistance,
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB