ocrd_cis/javaprocess.py
def run(self, _input):
        """
        Run the process with the given input and get its output.
        The process writes _input to stdin of the process.
        """
        cmd = self.get_cmd()
        self.log.info('command: %s', " ".join(cmd))
        self.log.debug('input: %s', _input)
        with subprocess.Popen(
                cmd,
                stdout=subprocess.PIPE,
                stdin=subprocess.PIPE,
                stderr=subprocess.PIPE,
                # only since 3.6: encoding='utf-8',
        ) as p:
            output, err = p.communicate(input=_input.encode('utf-8'))
            self.log_stderr(err)
            output = output.decode('utf-8')
            self.log.debug("got output")
            retval = p.wait()
            self.log.debug("waited")
            self.log.debug("%s: %i", " ".join(cmd), retval)
            if retval != 0:
                raise ValueError(
                    "cannot execute {}: {}\n{}"
                    .format(" ".join(cmd), retval, err.decode('utf-8')))
            # self.log.info('output: %s', output)
            return output

        Run the process with the given input and get its output.
        The process writes _input to stdin of the process.
        
Run the process with the given input and get its output.
The process writes _input to stdin of the process.
Run the process with the given input and get its output . The process writes _input to stdin of the process .
def run(self, _input):
        cmd = self.get_cmd()
        self.log.info('command: %s', " ".join(cmd))
        self.log.debug('input: %s', _input)
        with subprocess.Popen(
                cmd,
                stdout=subprocess.PIPE,
                stdin=subprocess.PIPE,
                stderr=subprocess.PIPE,
        ) as p:
            output, err = p.communicate(input=_input.encode('utf-8'))
            self.log_stderr(err)
            output = output.decode('utf-8')
            self.log.debug("got output")
            retval = p.wait()
            self.log.debug("waited")
            self.log.debug("%s: %i", " ".join(cmd), retval)
            if retval != 0:
                raise ValueError(
                    "cannot execute {}: {}\n{}"
                    .format(" ".join(cmd), retval, err.decode('utf-8')))
            return output
def run ( self , _input ) : cmd = self . get_cmd ( ) self . log . info ( 'command: %s' , " " . join ( cmd ) ) self . log . debug ( 'input: %s' , _input ) with subprocess . Popen ( cmd , stdout = subprocess . PIPE , stdin = subprocess . PIPE , stderr = subprocess . PIPE , ) as p : output , err = p . communicate ( input = _input . encode ( 'utf-8' ) ) self . log_stderr ( err ) output = output . decode ( 'utf-8' ) self . log . debug ( "got output" ) retval = p . wait ( ) self . log . debug ( "waited" ) self . log . debug ( "%s: %i" , " " . join ( cmd ) , retval ) if retval != 0 : raise ValueError ( "cannot execute {}: {}\n{}" . format ( " " . join ( cmd ) , retval , err . decode ( 'utf-8' ) ) ) return output
Run the process with the given input and get its output.
Run the process with the given input and get its output .
"""
        Run the process with the given input and get its output.
        The process writes _input to stdin of the process.
        """ # only since 3.6: encoding='utf-8', # self.log.info('output: %s', output)
self
_input