Skip to content

Commit

Permalink
OPM#11463 Look for resinsight_executable in JSON
Browse files Browse the repository at this point in the history
Search for resinsight_executable in JSON-file located at ./share/rips/rips_config.json
  • Loading branch information
magnesj committed Jun 3, 2024
1 parent 7985f50 commit 2378910
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion GrpcInterface/Python/rips/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import time
import tempfile
import signal
import sys
import json

import grpc

Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 2378910

Please sign in to comment.