A question about a list and subprocess.check_call()
David Aldrich
David.Aldrich at EMEA.NEC.COM
Mon Feb 16 12:07:28 EST 2015
Hi Peter
Thanks very much for your reply. I have added one more question below.
> The straightforward approach is to pass a list or tuple:
>
> def build(build_options=()):
> subprocess_check_call(("make",) + build_options)
>
> build(("flagA=true", "flagB=true"))
This looks fine - I am trying it.
I would like to display on the console the entire make command, so I have done this:
def build(build_options=()):
make_command = 'make '.join(map(build_options))
print('Build command: ' + make_command)
subprocess.check_call(("make",)+build_options)
but I get error:
make_command = 'make '.join(map(build_options))
TypeError: map() must have at least two arguments.
What would be the correct way to concatenate and display the elements in the tuple please?
Best regards
David
More information about the Python-list
mailing list