Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!newsfeed.eweka.nl!eweka.nl!feeder3.eweka.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.010 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'cpython': 0.05; 'shortcut': 0.09; 'subprocess': 0.09; 'received:209.85.210.174': 0.13; 'received:mail-iy0-f174.google.com': 0.13; 'invoking': 0.16; 'os.environ': 0.16; 'subject:subprocess': 0.16; 'thunderbird': 0.16; 'subject:question': 0.17; 'wrote:': 0.18; '(which': 0.19; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; "user's": 0.23; 'shell': 0.24; 'windows': 0.26; 'anyway.': 0.29; 'pm,': 0.29; "can't": 0.32; 'message-id:@gmail.com': 0.33; 'header:User- Agent:1': 0.33; 'to:addr:python-list': 0.34; 'question': 0.36; 'received:192': 0.37; 'received:google.com': 0.37; 'another': 0.37; 'using': 0.38; 'received:209.85': 0.38; 'why': 0.39; 'received:209': 0.40; 'to:addr:python.org': 0.40; 'received:192.168': 0.40; 'skip:o 30': 0.63; 'home': 0.65; '10:39': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; bh=yKELyKIfxwOmX7cOBa3DRyGsOokLIAtGRZYKuAhjlkQ=; b=PqNtAHPxatwdpgpQ7lm0PsB6TWFqhFi6Jjzh8gjDz0p62fQVr84J7EQQ/UhKPd3j9g AVfgy7d8e/i73DZBu8jmLkkqQvMS/6HVd2yWJ1rb5AMZMsZbPTskBnCdhmUFeRNyHcfx RMWl3l6YMWnZp08UYvsB9+UzGr1gEMy/BoPP4= Date: Sun, 11 Dec 2011 23:24:14 -0600 From: Andrew Berg User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0) Gecko/20110922 Thunderbird/7.0 MIME-Version: 1.0 To: "comp.lang.python" Subject: Re: subprocess question References: <20111212043933.BCJ1L.23648.root@cdptpa-web38-z02.mail.rr.com> In-Reply-To: <20111212043933.BCJ1L.23648.root@cdptpa-web38-z02.mail.rr.com> X-Enigmail-Version: 1.3.3 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1323667463 news.xs4all.nl 6869 [2001:888:2000:d::a6]:56700 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17012 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