From afb37e944fdf510c68033e11b588ff6f44d7a2b6 Mon Sep 17 00:00:00 2001 From: Roy Willy Haug <5484176+roywilly@users.noreply.github.com> Date: Fri, 24 Mar 2023 12:47:17 +0100 Subject: [PATCH] Make SEGYImport work great again on windows (#159) --- src/fmu/sumo/uploader/_fileondisk.py | 7 ++++--- tests/test_uploader.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/fmu/sumo/uploader/_fileondisk.py b/src/fmu/sumo/uploader/_fileondisk.py index d8bd6e22..f7e0d57b 100644 --- a/src/fmu/sumo/uploader/_fileondisk.py +++ b/src/fmu/sumo/uploader/_fileondisk.py @@ -73,12 +73,13 @@ def _get_segyimport_cmdstr(blob_url, object_id, file_path, sample_unit): url_conn = '"Suffix=?' + blob_url["auth"] + '"' persistent_id = '"' + object_id + '"' - pythonPath = os.path.dirname(sys.executable) - path_to_SEGYImport = os.path.join(pythonPath, '..', 'bin', 'SEGYImport') + python_path = os.path.dirname(sys.executable) + path_to_SEGYImport = os.path.join(python_path, '..', 'bin', 'SEGYImport') + if sys.platform.startswith("win"): + path_to_SEGYImport = path_to_SEGYImport + ".exe" if not os.path.isfile(path_to_SEGYImport): path_to_SEGYImport = os.path.join(python_path, '..', 'shims', 'SEGYImport') - cmdstr = ' '.join([path_to_SEGYImport, '--compression-method', 'RLE', '--brick-size', '64', diff --git a/tests/test_uploader.py b/tests/test_uploader.py index a0e4f548..02add7bd 100644 --- a/tests/test_uploader.py +++ b/tests/test_uploader.py @@ -210,6 +210,8 @@ def test_openvds_available(token): python_path = os.path.dirname(sys.executable) logger.info(python_path) path_to_SEGYImport = os.path.join(python_path, '..', 'bin', 'SEGYImport') + if sys.platform.startswith("win"): + path_to_SEGYImport = path_to_SEGYImport + ".exe" if not os.path.isfile(path_to_SEGYImport): path_to_SEGYImport = os.path.join(python_path, '..', 'shims', 'SEGYImport')