https://pantsbuild.org/ logo
#general
Title
# general
w

worried-salesclerk-37834

08/11/2021, 5:48 PM
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

hundreds-father-404

08/11/2021, 5:50 PM
does this still happen when using a single quote
'
instead of
"
?
w

witty-crayon-22786

08/11/2021, 5:52 PM
yuck. sorry for the trouble there.
1
which version of pants is this?
w

worried-salesclerk-37834

08/11/2021, 5:58 PM
2.6.0
Checking single quotes now
Yes, it still is separated with both single and double quotes surrounding the arg.
w

witty-crayon-22786

08/11/2021, 6:04 PM
sorry for the trouble. will get a patch out for that.
w

worried-salesclerk-37834

08/11/2021, 6:14 PM
Thanks for looking into it! Could you just give a shout out here when it's released?
👍 1
w

witty-crayon-22786

08/11/2021, 10:30 PM
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

hundreds-father-404

08/17/2021, 4:49 PM
(Wrong chris)
👍 1
w

worried-salesclerk-37834

08/17/2021, 4:59 PM
Thanks for the heads-up! Will be testing the fix in 2.6 out in the next few days.