Skip to content

Commit

Permalink
fix: Fixed exception when the python executable path has a space in it (
Browse files Browse the repository at this point in the history
#267)

Co-authored-by: Ivan Cheung <ivanmkc@google.com>
  • Loading branch information
ivanmkc and Ivan Cheung committed Mar 22, 2021
1 parent 9dff2a6 commit 755e7ad
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions google/cloud/aiplatform/training_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -832,9 +832,7 @@ class _TrainingScriptPythonPackager:
description='My training application.'
)"""

_SETUP_PY_SOURCE_DISTRIBUTION_CMD = (
"{python_executable} setup.py sdist --formats=gztar"
)
_SETUP_PY_SOURCE_DISTRIBUTION_CMD = "setup.py sdist --formats=gztar"

# Module name that can be executed during training. ie. python -m
module_name = f"{_ROOT_MODULE}.{_TASK_MODULE_NAME}"
Expand Down Expand Up @@ -908,9 +906,9 @@ def make_package(self, package_directory: str) -> str:
shutil.copy(self.script_path, script_out_path)

# Run setup.py to create the source distribution.
setup_cmd = self._SETUP_PY_SOURCE_DISTRIBUTION_CMD.format(
python_executable=_get_python_executable()
).split()
setup_cmd = [
_get_python_executable()
] + self._SETUP_PY_SOURCE_DISTRIBUTION_CMD.split()

p = subprocess.Popen(
args=setup_cmd,
Expand Down

0 comments on commit 755e7ad

Please sign in to comment.