RE: A question about a list and subprocess.check_call()

2015-02-17 Thread David Aldrich
>It's also possible to do it the other around using shlex.split. I prefer that >version because >I can easily copy/paste the command from code to the shell, it's also more >readable IMO: > cmd = """python3 -O -c "import sys; print(sys.argv[1:])" foo bar "spam egg" > """ > print(cmd) > subproc

Re: A question about a list and subprocess.check_call()

2015-02-16 Thread Amirouche Boubekki
On Mon Feb 16 2015 at 7:40:42 PM Peter Otten <__pete...@web.de> wrote: > David Aldrich wrote: > > > 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=()): > >>

RE: A question about a list and subprocess.check_call()

2015-02-16 Thread Peter Otten
David Aldrich wrote: > 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=

Re: A question about a list and subprocess.check_call()

2015-02-16 Thread MRAB
On 2015-02-16 17:07, David Aldrich wrote: 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=tru

RE: A question about a list and subprocess.check_call()

2015-02-16 Thread David Aldrich
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 tryi

Re: A question about a list and subprocess.check_call()

2015-02-16 Thread Peter Otten
David Aldrich wrote: > Hi > > I wonder if someone could help me with this problem please. I am writing > a Python script that builds and tests a C++ program on Linux. The build > options depend on the test, so I have encapsulated the 'make' call in a > Python function: > > def build(build_opti