[sapug] python subprocess.call variable

Daryl Tester dt-sapug at handcraftedcomputers.com.au
Tue May 25 10:17:01 CEST 2010


Garry Trethewey wrote:

> subprocess.call('scanimage  -args-  > ${outfile}', shell = True)
> 
> but I can only do
> 
> subprocess.call('scanimage  -args-  > /home/garry/Desktop/junk', shell = 
> True)

This is just standard string substitution (see 3.6.2 "String Formatting
Operations <http://docs.python.org/release/2.5.2/lib/typesseq-strings.html>).

You might use (given outfile = '/some/path'):

subprocess.call('scanimage -args- > %s' % outfile, shell = True)

Or are you actually trying to retrieve $HOME?


-- 
Regards,
  Daryl Tester


More information about the sapug mailing list