diff --git a/GrpcInterface/Python/rips/instance.py b/GrpcInterface/Python/rips/instance.py index 1f6f7b0f70..4fc7603f35 100644 --- a/GrpcInterface/Python/rips/instance.py +++ b/GrpcInterface/Python/rips/instance.py @@ -12,6 +12,8 @@ import time import tempfile import signal +import sys +import json import grpc @@ -30,7 +32,7 @@ from typing import List, Optional, Tuple from typing_extensions import Self - +from pathlib import Path class Instance: """The ResInsight Instance class. Use to launch or find existing ResInsight instances @@ -121,6 +123,16 @@ def launch( if launch_port != -1: requested_port = launch_port + if not resinsight_executable: + filename = Path(sys.prefix) / "share" / "rips" / "rips_config.json" + print("Looking for config file", filename) + if filename.is_file(): + f = open(filename) + data = json.load(f) + resinsight_executable = data['resinsight_executable'] + if resinsight_executable: + print(" Found resinsight_executable:", resinsight_executable) + if not resinsight_executable: resinsight_executable_from_env = os.environ.get("RESINSIGHT_EXECUTABLE") if not resinsight_executable_from_env: