Re: Executing a command from within python using the subprocess module

2010-02-18 Thread Aahz
In article <5yudnafyso8houtwnz2dnuvz_tidn...@westnet.com.au>, R (Chandra) Chandrasekhar wrote: > >--- >import subprocess > >width = 5 >height = 30 >colors = ['#abcdef]', '#456789'] >filename = "/tmp/image.png" > ># I want to get the equivalent of variable interpolation in Perl ># so that the comma

Re: Executing a command from within python using the subprocess module

2010-02-15 Thread Nobody
On Tue, 16 Feb 2010 00:11:36 +0800, R (Chandra) Chandrasekhar wrote: > One other question I forgot to ask is this why is there a terminal > backslash in > >> subprocess.call("""\ > > Removing the backslash makes the function fail. > > I wonder why, because """ is supposed to allow multi-line s

Re: Executing a command from within python using the subprocess module

2010-02-15 Thread Peter Otten
R (Chandra) Chandrasekhar wrote: > Peter Otten wrote: > >> import subprocess >> >> def convert(width=5, height=30, colors=['#abcdef', '#456789'], >> filename="tmp/image with space in its name.png"): >> lookup = locals() >> assert all("\n" not in str(s) for s in lookup.values(

Re: Executing a command from within python using the subprocess module

2010-02-15 Thread R (Chandra) Chandrasekhar
Alf P. Steinbach wrote: * R (Chandra) Chandrasekhar: width = 5 height = 30 colors = ['#abcdef]', '#456789'] filename = "/tmp/image.png" # I want to get the equivalent of variable interpolation in Perl # so that the command # # convert -size 5x30 gradient:#abcdef-#456789 /tmp/image.png # # is d

Re: Executing a command from within python using the subprocess module

2010-02-15 Thread Steve Holden
R (Chandra) Chandrasekhar wrote: > Peter Otten wrote: >> import subprocess >> >> def convert(width=5, height=30, colors=['#abcdef', '#456789'], >> filename="tmp/image with space in its name.png"): >> lookup = locals() >> assert all("\n" not in str(s) for s in lookup.values()) >>

Re: Executing a command from within python using the subprocess module

2010-02-15 Thread R (Chandra) Chandrasekhar
Peter Otten wrote: import subprocess def convert(width=5, height=30, colors=['#abcdef', '#456789'], filename="tmp/image with space in its name.png"): lookup = locals() assert all("\n" not in str(s) for s in lookup.values()) subprocess.call("""\ convert -size {width}x{heig

Re: Executing a command from within python using the subprocess module

2010-02-15 Thread John Posner
On 2/15/2010 7:35 AM, R (Chandra) Chandrasekhar wrote: Dear Folks, I want to execute a command from within python using the subprocess module. Coming from a Perl background, I thought I could use variable interpolation in strings, but found that this is neither supported Yes, it is: see the u

Re: Executing a command from within python using the subprocess module

2010-02-15 Thread R (Chandra) Chandrasekhar
Peter Otten wrote: import subprocess def convert(width=5, height=30, colors=['#abcdef', '#456789'], filename="tmp/image with space in its name.png"): lookup = locals() assert all("\n" not in str(s) for s in lookup.values()) subprocess.call("""\ convert -size {width}x{hei

Re: Executing a command from within python using the subprocess module

2010-02-15 Thread Peter Otten
R (Chandra) Chandrasekhar wrote: > I want to execute a command from within python using the subprocess > module. > > Coming from a Perl background, I thought I could use variable > interpolation in strings, but found that this is neither supported nor > the Python way. Accordingly, I am a little

Re: Executing a command from within python using the subprocess module

2010-02-15 Thread Alf P. Steinbach
* R (Chandra) Chandrasekhar: width = 5 height = 30 colors = ['#abcdef]', '#456789'] filename = "/tmp/image.png" # I want to get the equivalent of variable interpolation in Perl # so that the command # # convert -size 5x30 gradient:#abcdef-#456789 /tmp/image.png # # is derived from the variables

Executing a command from within python using the subprocess module

2010-02-15 Thread R (Chandra) Chandrasekhar
Dear Folks, I want to execute a command from within python using the subprocess module. Coming from a Perl background, I thought I could use variable interpolation in strings, but found that this is neither supported nor the Python way. Accordingly, I am a little at sea about how to accomplis