rivia.controller¶
COM interface to run and control HEC-RAS. Windows only; requires pywin32.
COM interface to run and control HEC-RAS.
- exception rivia.controller.HecRasComputeError(message, messages=(), com_error=None)[source]¶
Bases:
RuntimeErrorRaised when a HEC-RAS computation fails or the COM call errors.
- Variables:
messages (tuple[str, ...]) – Messages returned by HEC-RAS at the time of failure. Empty when the version does not expose messages or when the error is COM-level.
com_error (pywintypes.com_error or None) – The underlying COM exception, if the failure was a COM-level error.
Nonewhen HEC-RAS returnedsuccess=Falsewithout a COM error.
- Parameters:
- rivia.controller.connect(version)[source]¶
Return a version-appropriate HEC-RAS controller, reusing a live one if available.
If a controller for the requested version is already alive (process running and COM responsive), it is returned directly without killing or relaunching HEC-RAS. Only when no live controller exists is a new one launched; any stale HEC-RAS process for that version is terminated first.
- Parameters:
version (str or int) – HEC-RAS version to connect to. Accepts a version string (e.g.
"6.3","5.0.3") or an integer version code (e.g.6030). Must match an installed HEC-RAS entry in the Windows registry.- Returns:
A controller instance connected to the requested HEC-RAS version. The exact type depends on the resolved version number:
_Controller400for versions below 5000,_Controller500for 5000-5029, and_Controller503for 5030 and above.- Return type:
_Controller400 or _Controller500 or _Controller503
- Raises:
RuntimeError – If the requested HEC-RAS version is not found in the Windows registry.
Submodules
Cached lookup of installed HEC-RAS versions and their COM ProgIDs. |
|