1

in VScode on linux, when I need to set an argument for the python executable my_scipt.py that I am working on,
and this arg is supposed to be a glob pattern like some/where/like_*,
I suspect it could be done by passing this arg in the jscript description
of the run configuration (in workspace or folder files).

so I do smth. like:

"configurations": [
{...
"program": "some/where/my_scipt.py",
"args": ["--glob", "some/where/like_*", ...],
...}
]

but this will be expanded to the list of all found glob matches on execution of the run configuration.

  • quoting does not help, because then the glob pattern is not understood.
  • tried: "'lkajs/ölksafd_*'"
  • tried: "\"lkajs/ölksafd_*\""
  • tried: "lkajs/ölksafd_\*"
  • tried: "lkajs/ölksafd_\\*"

what do I miss?

qbit
  • 25
  • 3
  • I have a similar issue with [passing arguments with `cmd` in Windows](https://github.com/microsoft/vscode/issues/145265), there is not a method to describe the addition of quotes to all/certain arguments, It looks like the Powershell method is better because it puts all arguments in quotes, but not handy if you want the shell to expand wildcards, but sometimes you don't want to, maybe the number of files will exceed the command line maximum length, some people have >1000 files to process – rioV8 Mar 31 '22 at 00:56
  • under windows vscode, and due to different/missing glob shell expansion, this seems to work as expected with the initial syntax example. for linux there seems to be a bash shell injection of falsely parsed arguments on execution of the run config. – qbit Mar 31 '22 at 08:27
  • Can you use the last pattern `"lkajs/ölksafd_\\*"` and then in your `.py`, you remove double backslashes before * ? – Philippe Apr 01 '22 at 00:09
  • @Philippe if I understood you correctly, this solution this makes no sense to me, since when calling the script from e.g. ipython or the shell, it should also work. I want consistent behavior. – qbit Apr 01 '22 at 16:43
  • 1
    I know that. What I suggested is just a workaround due to the limitation of vscode. – Philippe Apr 01 '22 at 17:44

0 Answers0