You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
default shell on both Windows and VSCode is powershell
directory with Python virtualenv contains a whitespace in hte path
How To Reproduce the bug
Set powershell as the default shell
Create a new project in the directory with name a b c. Create virtualenv in that directory, install promptflot tooling in this venv.
Try to open PF extension and do anything: create a connection or run a flow. It will fail with the following error:
(base) PS C:\Users\username\a b c\flows\tagging> cd "c:\Users\username\a b c\flows\tagging"
(base) PS C:\Users\username\a b c\flows\tagging> "c:\Users\username\a b c\.venv\Scripts\python.exe" -m promptflow._cli._pf.entry flow test --flow "c:\Users\username\a b c\flows\tagging" --user-agent "prompt-flow-extension/1.20.2 (win32; x64) VSCode/1.95.0"
At line:1 char:69
+ ... \username\a b c\.venv\Scripts\python.exe" -m promptf ...
+ ~~
Unexpected token '-m' in expression or statement.
At line:1 char:72
+ ... a b c\.venv\Scripts\python.exe" -m promptflow._cli._pf.entry flow te ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token 'promptflow._cli._pf.entry' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
Additional context
When the path to the Python interpreter contains a whitespace, the extension encloses the whole path in double quotes.
Unlike in the other shells, powershell can't properly parse it when the full path to the executable is passed as a string.
Unminified extension code (see below) suggests that the double quotes aren't added by the extension itself. Either child_process.spawn adds them before calling the child process, or pythonExtensionApi.environments.getActiveEnvironmentPath().path already returns a path with the double quotes.
Either way, to call Python in powershell, one must not enclose the full path to the executable in double quotes. More precisely, you can't start the path to the executable with a double quote.
gukoff
changed the title
[BUG] [VSCode Extension]
[BUG] [VSCode Extension] Can't run when powershell is default shell, and there's a whitespace in project name
Nov 1, 2024
gukoff
changed the title
[BUG] [VSCode Extension] Can't run when powershell is default shell, and there's a whitespace in project name
[BUG] [VSCode Extension] Can't run with powershell & whitespace in project name
Nov 4, 2024
Describe the bug
Fails to run when:
How To Reproduce the bug
a b c
. Create virtualenv in that directory, install promptflot tooling in this venv.Additional context
When the path to the Python interpreter contains a whitespace, the extension encloses the whole path in double quotes.
Unlike in the other shells, powershell can't properly parse it when the full path to the executable is passed as a string.
Unminified extension code (see below) suggests that the double quotes aren't added by the extension itself. Either
child_process.spawn
adds them before calling the child process, orpythonExtensionApi.environments.getActiveEnvironmentPath().path
already returns a path with the double quotes.Either way, to call Python in powershell, one must not enclose the full path to the executable in double quotes. More precisely, you can't start the path to the executable with a double quote.
The text was updated successfully, but these errors were encountered: