honeybee_plus.radiance.command.pyRad.pyRadLib.pyrad_proc module

pyrad_proc.py - Process and pipeline management for Python Radiance scripts 2016 - Georg Mischler

Use as:

from pyradlib.pyrad_proc import PIPE, Error, ProcMixin

For a single-file installation, include the contents of this file at the same place (minus the __future__ import below).

exception honeybee_plus.radiance.command.pyRad.pyRadLib.pyrad_proc.Error[source]

Bases: Exception

class honeybee_plus.radiance.command.pyRad.pyRadLib.pyrad_proc.ProcMixin[source]

Bases: object

Process and pipeline management for Python Radiance scripts

call_many(cmdlines, actstr, _in=None, out=None, universal_newlines=False)[source]

Create a series of N processes, chained via pipes, possibly with an incoming and outgoing pipe at each end. Returns a tuple of N subprocess.Popen instances. Depending on the values of _in and out, the first and last may be available to write to or read from respectively. Most arguments are equivalent to call_one(), with - cmdlines

a list of N command argument lists

  • _in / out applying to the ends of the chain.

If _in or out is PIPE, the caller should call p.wait() on all returned Popen instances after writing to and closing the first one.

call_one(cmdl, actstr, _in=None, out=None, universal_newlines=False)[source]
Create a single subprocess, possibly with an incoming and outgoing

pipe at each end. - cmdl

A list of strings, leading with the name of the executable (without the *.exe suffix), followed by individual arguments.

  • actstr A text string of the form “do something”. Used in verbose mode as “### do someting

### [command line]”

Used in error messages as “Scriptname: Unable to do something”.

  • _in / out What to do with the input and output pipes of the process: * a filename as string

    Open file and use for reading/writing.

    • a file like object Use for reading/writing

    • PIPE Pipe will be available in returned object for reading/writing.

    • None (default) System stdin/stdout will be used if available

If _in or out is a PIPE, the caller should call p.wait() on the returned Popen instance after writing to and closing it.

call_two(cmdl_1, cmdl_2, actstr_1, actstr_2, _in=None, out=None, universal_newlines=False)[source]

Create two processes, chained via a pipe, possibly with an incoming and outgoing pipe at each end. Returns a tuple of two Popen instances. Arguments are equivalent to call_one(), with _in and out applying to the ends of the chain. If _in or out is PIPE, the caller should call p.wait() on both returned popen instances after writing to and closing the first on .

qjoin(sl)[source]

Join a list with quotes around each element containing whitespace. We only use this to display command lines on sys.stderr, the actual Popen() calls are made with the original list.

raise_on_error(actstr, e)[source]