Skip to content

Cannot set custom python.exe path with spaces for GAUGE_PYTHON_COMMAND #437

Closed

Description

@JakubStyczen

Describe the bug
Given:
Windows 11
VS Code 1.100.1
Gauge VS Code extension 0.2.3
Gauge 1.6.11
gauge-python 0.4.9
Python venv for e.g. 3.8/3.11/3.12
python.exe path: C:\Repos\Space Path\410_driverdevexpress.venv\Scripts\python.exe

When:

  • Using custom python .venv (set GAUGE_PYTHON_COMMAND to python.exe path in this .venv). Path is absolute and containing spaces e.g. C:\Repos\Space Path\410_driverdevexpress.venv\Scripts\python.exe. Tried to set it without and with quotes.
  • Trying to run specs in vs code or running in terminal by gauge run "./specs".

Then:
For both cases of GAUGE_PYTHON_COMMAND (with and without quotes):
In VS Code there is visible error after opening repo: "Gauge could not initialize. Install 'ms-python.python' extension for code insights":
Image

  1. For GAUGE_PYTHON_COMMAND without quotes:
    When trying to manually run tests gauge run ./specs also fails with:
    Image

  2. For GAUGE_PYTHON_COMMAND with quotes:
    When trying to manually run tests gauge run ./specs also fails with:
    Image

See more in gauge.log

To Reproduce

  1. Initialize a gauge project with dir containing spaces in vs code with proper versions and gauge extension.
  2. Create python venv and set GAUGE_PYTHON_COMMAND to path to python.exe in that venv.
  3. Try to run tests via vs code or by running gauge run "./specs".

Logs

GAUGE_PYTHON_COMMAND without quotes:
gauge.log

GAUGE_PYTHON_COMMAND with quotes:
gauge.log

Expected behavior
When removing space from path problem disappears (In both cases) and tests run regardless of the path.

Versions:

gauge -v

Gauge version: 1.6.11
Commit Hash: c779a46

Plugins
-------
html-report (4.3.1)
json-report (0.4.0)
python (0.4.9)
screenshot (0.3.0)

Windows 11
VS Code 1.100.1
Gauge VS Code extension 0.2.3
Gauge 1.6.11
gauge-python 0.4.9
Python venv for e.g. 3.8/3.11/3.12
python.exe path: C:\Repos\Space Path\410_driverdevexpress.venv\Scripts\python.exe

Additional context
After debugging I discovered that problem is in start.bat file both cmd command and vs code executes it before running tests.

@echo off
IF "%GAUGE_PYTHON_COMMAND%"=="" (SET GAUGE_PYTHON_COMMAND="python")
%GAUGE_PYTHON_COMMAND% check_and_install_getgauge.py
%GAUGE_PYTHON_COMMAND% -u start.py %1

For first case (without quotes) cmd treat first part of path as a command that do not exists and fails at 3rd line of above script.
For second case (with quotes) variable (at line 2nd) is double quoted and fails too.
Change way of pasting command to cmd (to not treat first part of path as a command).
Consider using quoted version of path and check if variable exists or is empty should be fixed to enable quotes for GAUGE_PYTHON_COMMAND.

Activity

  1. transferred this issue fromgetgauge/gaugeon May 19, 2025
  2. chadlwilson commented on May 19, 2025

    @chadlwilson
    Contributor

    Try updating your Python plugin to the 0.4.10 version when it promotes shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions