F.Lira
F.Lira

Reputation: 663

call subprocess python with no spaces

Considering one variable "outdir", included in the command line to create a directory where I will deposit my outputs, what is the best option to call a subprocess that only accept the parameters like "-o=both" and do not permit spaces between the parameter (-d=) and the value (outdir)?

'-o=both','-m=both' and '-t=4' can be established before and I have it already included in my script.

This is the line that I used:

subprocess.call(['external_script.pl', '-d=',outdir,'-o=both','-m=both','-t=4'])

Upvotes: 0

Views: 88

Answers (2)

F.Lira
F.Lira

Reputation: 663

I changed the ',' for a '+' in the line and it worked.

subprocess.call(['external_script.pl', '-d='+outdir,'-o=both','-m=both','-t=4'])

Upvotes: 0

Borian
Borian

Reputation: 106

why not just putting your parameter as you need:

['external_script.pl', '-d=%s' % outdir,'-o=both','-m=both','-t=4']

Upvotes: 1

Related Questions