+4  A: 

Try using string.join:

p = subprocess.Popen(args = "myprog.exe" + " " +
                     str(input1) + " " +
                     str(input2) + " " +
                     str(input3) + " " +
                     " ".join(strpoints), stdout = subprocess.PIPE)
TokenMacGuy
neat, thanks that did it!
B Rivera
Drat, I almost had it!
Jonathanb
+7  A: 

args can be a sequence:

p = subprocess.Popen(args = ["myprog.exe"] + 
                            [str(x) for x in [input1,input2,input3]] + 
                            strpoints,stdout = subprocess.PIPE)

This is more correct if your arguments contain shell metacharacters e.g. ' * and you don't want them interpreted as such.

wrang-wrang
+1 thanks. i didn't know i could iterate like that.
B Rivera
+1  A: 

Avoid concatenating all arguments into one string using that string.

It's a lot simpler and better and safer to just pass a sequence (list or tuple) of arguments. This is specially true if any argument contains a space character (which is quite common for filenames).

Denilson Sá
A: 

Any thought that you might want to enclose those strings in quotes, in case they have embedded spaces? Something like:

if strpoints:
    finalargs = '"' + '" "'.join(strpoints) + '"'
else:
    finalargs = ""
p = subprocess.Popen(args = "myprog.exe" + " " +
                 str(input1) + " " +
                 str(input2) + " " +
                 str(input3) + " " +
                 finalargs, stdout = subprocess.PIPE)

This makes your string longer, but will preserve the integrity of your individual elements in the list.

Paul McGuire