0

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'])
1
  • I am a little bit confused what you are asking. You could avoid the spaces by passing outdir.strip() or check with a if statement before subprocess if there are spaces at the start of outdir? Commented Dec 13, 2017 at 8:32

2 Answers 2

1

why not just putting your parameter as you need:

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.