Trees | Indices | Help |
|
---|
|
object --+ | Command
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
command_name = None Derive a class from command; typically one only has to set *command_name* to the name of the script or executable. |
|
|||
Inherited from |
|
Set up the command class. The arguments can always be provided as standard positional arguments such as "-c", "config.conf", "-o", "output.dat", "--repeats=3", "-v", "input.dat" In addition one can also use keyword arguments such as c="config.conf", o="output.dat", repeats=3, v=True These are automatically transformed appropriately according to simple rules:
If this does not work (as for instance for the options of the UNIX find command) then provide options and values in the sequence of positional arguments.
|
Returns a special Popen instance (:class:`PopenWithInput`). The instance has its input pre-set so that calls to :meth:`~PopenWithInput.communicate` will not need to supply input. This is necessary if one wants to chain the output from one command to an input from another. :TODO: Write example. |
|
Run command with the given arguments:: rc,stdout,stderr = command(*args, input=None, **kwargs) All positional parameters \*args and all gromacs \*\*kwargs are passed on to the Gromacs command. input and output keywords allow communication with the process via the python subprocess module. :Arguments: *input* : string, sequence to be fed to the process' standard input; elements of a sequence are concatenated with newlines, including a trailing one [``None``] *stdin* ``None`` or automatically set to ``PIPE`` if input given [``None``] *stdout* how to handle the program's stdout stream [``None``] filehandle anything that behaves like a file object ``None`` or ``True`` to see output on screen ``False`` or ``PIPE`` returns the output as a string in the stdout parameter *stderr* how to handle the stderr stream [``STDOUT``] ``STDOUT`` merges standard error with the standard out stream ``False`` or ``PIPE`` returns the output as a string in the stderr return parameter ``None`` or ``True`` keeps it on stderr (and presumably on screen) All other kwargs are passed on to the Gromacs tool. :Returns: The shell return code rc of the command is always returned. Depending on the value of output, various strings are filled with output from the command. :Notes: By default, the process stdout and stderr are merged. In order to chain different commands via pipes one must use the special :class:`PopenWithInput` object (see :meth:`GromacsCommand.Popen` method) instead of the simple call described here and first construct the pipeline explicitly and then call the :meth:`PopenWithInput.communicate` method. ``STDOUT`` and ``PIPE`` are objects provided by the :mod:`subprocess` module. Any python stream can be provided and manipulated. This allows for chaining of commands. Use :: from subprocess import PIPE, STDOUT when requiring these special streams (and the special boolean switches ``True``/``False`` cannot do what you need.) (TODO: example for chaining commands) |
|
command_nameDerive a class from command; typically one only has to set *command_name* to the name of the script or executable. The full path is required if it cannot be found by searching :envvar:`PATH`.
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Sat Jun 12 15:59:35 2010 | http://epydoc.sourceforge.net |