Input not completely consumed

I have a parent pipeline calling another. Which runs successfully when you validate but errors when you execute. Why is this? It seems that the issue is coming form a pyton script in the child pipeline. The purpose of the script is the call a bat.file on a server and wait for the .bat file to complete and return the error message if any before the pipleline completes. If i validate the parent pipeline it calls the child pipeline and execute this script without issues but this is not the case when i execute. I am either getting an error saying on the script snap “Input not completely consumed” or other times “root pipeline no longer running”

the following is the script code

Import the interface required by the Script snap.

from com.snaplogic.scripting.language import ScriptHook
import java.util, os, subprocess

class TransformScript(ScriptHook):
def init(self, input, output, error, log):
self.input = input
self.output = output
self.error = error
self.log = log

# The "execute()" method is called once when the pipeline is started
# and allowed to process its inputs or just send data to its outputs.
def execute(self):
    filepath="C:\\Profisee\\ProfiseeMatch.bat & exit"
    p = subprocess.Popen(filepath, shell=True, stdout = subprocess.PIPE)
    p.communicate()
    p.wait()
    
    self.output.write (p.returncode)

The Script Snap will look for a ScriptHook object in the “hook”

variable. The snap will then call the hook’s “execute” method.

hook = TransformScript(input, output, error, log)

Any ideas what may be causing this and how this can be solved?

See the example python script in the doc page SnapLogic Documentation

The script needs to consume all the input documents which are passed in its input view. If you do not need the input docs, you could add a loop to drop the docs

def execute(self):
    while self.input.hasNext():
        data = self.input.next()

    filepath="C:\\Profisee\\ProfiseeMatch.bat & exit"
    p = subprocess.Popen(filepath, shell=True, stdout = subprocess.PIPE)
    p.communicate()
    p.wait()
    self.output.write (p.returncode)