From dt-sapug at handcraftedcomputers.com.au Wed May 19 10:35:53 2010 From: dt-sapug at handcraftedcomputers.com.au (Daryl Tester) Date: Wed, 19 May 2010 18:05:53 +0930 Subject: [sapug] US Pycon videos online Message-ID: <4BF3A2E9.2000105@handcraftedcomputers.com.au> Y'all. The 2010 Pycon in Atlanta has videoed their talks and put them online. A lot of potentially interesting stuff, if you have the time to sit down and watch that sort of thing ... -- Regards, Daryl Tester Member of the Amalgamated Australian Association Against Apostrophe Abuse. (formerly the 6A's - no, wait ...). From garrytre at bigpond.com Tue May 25 06:39:58 2010 From: garrytre at bigpond.com (Garry Trethewey) Date: Tue, 25 May 2010 14:09:58 +0930 Subject: [sapug] python subprocess.call variable Message-ID: <4BFB549E.10901@bigpond.com> Hello In python 2.5, ubuntu 8.04, how can I get a variable to work, instead of having to use a string literal, in the following? I want to do subprocess.call('scanimage -args- > ${outfile}', shell = True) but I can only do subprocess.call('scanimage -args- > /home/garry/Desktop/junk', shell = True) Everything on the web I've seen is a string literal, not a variable, except one instance of $HOME, which kinda doesn't count, because the variable already existed before. I've fiddled for 5 hours, time to ask for help. Anybody know how do do this? ------------------------------------ Garry Trethewey ------------------------------------ From dt-sapug at handcraftedcomputers.com.au Tue May 25 10:17:01 2010 From: dt-sapug at handcraftedcomputers.com.au (Daryl Tester) Date: Tue, 25 May 2010 17:47:01 +0930 Subject: [sapug] python subprocess.call variable In-Reply-To: <4BFB549E.10901@bigpond.com> References: <4BFB549E.10901@bigpond.com> Message-ID: <4BFB877D.5000801@handcraftedcomputers.com.au> 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 ). 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