From 8b42cb4fac14e29c403f77b423f773f312beac50 Mon Sep 17 00:00:00 2001 From: Aaron Steers Date: Tue, 5 Mar 2024 09:27:56 -0800 Subject: [PATCH] find executable on windows --- airbyte/_factories/connector_factories.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/airbyte/_factories/connector_factories.py b/airbyte/_factories/connector_factories.py index 5def9b77..0bd3c54f 100644 --- a/airbyte/_factories/connector_factories.py +++ b/airbyte/_factories/connector_factories.py @@ -2,6 +2,7 @@ from __future__ import annotations import shutil +import sys import warnings from pathlib import Path from typing import Any @@ -83,9 +84,18 @@ def get_source( # Assume this is a path local_executable = Path(local_executable).absolute() else: + if sys.platform == "win32": + local_executable = f"{local_executable}.exe" + which_executable = shutil.which(local_executable) if which_executable is None: - raise FileNotFoundError(local_executable) + raise exc.AirbyteConnectorExecutableNotFoundError( + connector_name=name, + context={ + "executable": local_executable, + "working_directory": Path.cwd().absolute(), + }, + ) from FileNotFoundError(local_executable) local_executable = Path(which_executable).absolute() print(f"Using local `{name}` executable: {local_executable!s}")