run_command

(function from pyomo.scripting.util)

pyomo.scripting.util.run_command(command=None, parser=None, args=None, name='unknown', data=None, options=None)[source]

Execute a function that processes command-line arguments and then calls a command-line driver.

This function provides a generic facility for executing a command function is rather generic. This function is segregated from the driver to enable profiling of the command-line execution.

Parameters:
  • command – The name of a function that will be executed to perform process the command-line options with a parser object.

  • parser – The parser object that is used by the command-line function.

  • options – If this is not None, then ignore the args option and use this to specify command options.

  • args – Command-line arguments that are parsed. If this value is None, then the arguments in sys.argv are used to parse the command-line.

  • name – Specifying the name of the command-line (for error messages).

  • data – A container of labeled data.

Returns:

  • retval – Return values from the command-line execution.

  • errorcode – 0 if Pyomo ran successfully