Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17012

Re: subprocess question

Date 2011-12-11 23:24 -0600
From Andrew Berg <bahamutzero8825@gmail.com>
Subject Re: subprocess question
References <20111212043933.BCJ1L.23648.root@cdptpa-web38-z02.mail.rr.com>
Newsgroups comp.lang.python
Message-ID <mailman.3530.1323667463.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 12/11/2011 10:39 PM, jyoung79@kc.rr.com wrote:
> And another question - why can't I use the tilde as a shortcut to the home directory?
Because subprocess doesn't use the shell (which is what expands the
tilde to the invoking user's home directory). I recommend using
os.path.join and os.environ anyway.

p = subprocess.Popen(['du', '-sh', os.path.join(os.environ['home'],
'.Trash')], stdout=subprocess.PIPE)

-- 
CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: subprocess question Andrew Berg <bahamutzero8825@gmail.com> - 2011-12-11 23:24 -0600

csiph-web