I am trying to run a command with subprocess.check_output
without using shell=True
keyword argument. My command is this:
command --
Adding to @Mark's answer, I specifically needed quotes to be passed to the program as well as quotes to surround the parameter. Basically this was what I needed:
make PAYOFF="\"{{0,1,-1},{-1,0,1},{1,-1,0}}\""
Python doesn't add the extra set of quotes to the very left and very right, so adding a space in front of the equals sign did the trick.
Calling the list2cmdline
functions as follows:
subprocess.list2cmdline(['make', 'PAYOFF ="{{0,1,-1},{-1,0,1},{1,-1,0}}"'])
would produce this result:
make "PAYOFF =\"{{0,1,-1},{-1,0,1},{1,-1,0}}\""