I'm trying to run an app that takes command line a...
# general
w
I'm trying to run an app that takes command line arguments and it seems to be splitting the arguments based on spaces, even when quoted.
Copy code
./pants run projects/executable:pex_binary -- --arg1 "many words separated"
I'm using argparse, and it blows up because it's not expecting an argument "words separated". Looking at sys.argv, they're all split up. This doesn't happen when I invoke the pex file directly. argparse's destination "arg1" has a value of "many words separated". Workaround when using pants is to escape all the spaces.
h
does this still happen when using a single quote
'
instead of
"
?
w
yuck. sorry for the trouble there.
1
which version of pants is this?
w
2.6.0
Checking single quotes now
Yes, it still is separated with both single and double quotes surrounding the arg.
w
sorry for the trouble. will get a patch out for that.
w
Thanks for looking into it! Could you just give a shout out here when it's released?
👍 1
w
this is fixed here: https://github.com/pantsbuild/pants/pull/12547 … assuming there aren’t any red flags, i’ll get that cherry-picked into 2.5.x/2.6.x
❤️ 1
@worried-salesclerk-37834 :
2.6.1rc1
and
2.5.2rc3
went out yesterday with this fix! https://pantsbuild.slack.com/archives/C18RRR4JK/p1629156618005800
h
(Wrong chris)
👍 1
w
Thanks for the heads-up! Will be testing the fix in 2.6 out in the next few days.