Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #17044
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!xindi.nntp.kabelfoon.nl!feed.xsnews.nl!border-2.ams.xsnews.nl!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <jyoung79@kc.rr.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.055 |
| X-Spam-Evidence | '*H*': 0.89; '*S*': 0.00; ':-)': 0.06; 'shortcut': 0.09; 'subprocess': 0.09; 'err': 0.16; 'subject:subprocess': 0.16; 'subject:question': 0.17; 'help.': 0.19; 'slightly': 0.19; 'cheers,': 0.20; 'shell': 0.24; 'import': 0.27; 'received:10.127': 0.30; 'received:75.180': 0.30; 'received:75.180.132': 0.30; 'received:cdptpa-omtalb.mail.rr.com': 0.30; 'chris': 0.30; 'url:library': 0.31; 'does': 0.32; "can't": 0.32; 'to:addr:python- list': 0.34; 'received:mail.rr.com': 0.34; 'thank': 0.35; 'url:python': 0.36; 'question': 0.36; 'security.': 0.37; 'reasons': 0.37; 'received:75': 0.37; 'another': 0.37; 'using': 0.38; 'skip:o 20': 0.38; 'received:rr.com': 0.39; 'url:docs': 0.39; 'url:org': 0.39; 'why': 0.39; 'to:addr:python.org': 0.40; 'might': 0.40; 'your': 0.61; 'from:no real name:2**0': 0.63; 'home': 0.65; 'yourself': 0.69; 'url:os': 0.84 |
| Authentication-Results | cdptpa-omtalb.mail.rr.com smtp.user=jyoung79@kc.rr.com; auth=pass (LOGIN) |
| X-Authority-Analysis | v=2.0 cv=KapQQHkD c=1 sm=0 a=IkcTkHD0fZMA:10 a=8AHkEIZyAAAA:8 a=qril8qUUEh1n3ePxloYA:9 a=sAIgZzkrgHfuPylsKk8A:7 a=QEXdDO2ut3YA:10 a=6Z_hFMlBv7QA:10 a=A4pbnY0UTNUA:10 a=vlExglOGJjceklXinUHbxg==:117 |
| X-Cloudmark-Score | 0 |
| Date | Mon, 12 Dec 2011 14:49:06 +0000 |
| From | <jyoung79@kc.rr.com> |
| To | python-list@python.org |
| Subject | RE: subprocess question |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8 |
| Content-Transfer-Encoding | 7bit |
| X-Priority | 3 (Normal) |
| Sensitivity | Normal |
| X-Originating-IP | |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3546.1323701349.27778.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1323701349 news.xs4all.nl 6897 [2001:888:2000:d::a6]:48879 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:17044 |
Show key headers only | View raw
>>>>> import subprocess >>>>> p = subprocess.Popen(['du', '-sh'], cwd='/Users/jay/.Trash/', >> stdout=subprocess.PIPE) >>>>> out, err = p.communicate() >>>>> out >> ' 11M\t.\n' > You might prefer to use subprocess.check_output(); it slightly > simplifies your code: > http://docs.python.org/library/subprocess.html#subprocess.check_output >> And another question - why can't I use the tilde as a shortcut to the home >> directory? > Because ~ is interpolated by the shell and `subprocess` does not use > the shell by default for reasons that include efficiency and security. > You can expand ~ yourself using os.path.expanduser(): > http://docs.python.org/library/os.path.html#os.path.expanduser > Alternatively, you can opt to use the shell by passing shell=True as > an argument. > Cheers, > Chris Thank you very much, Chris and Andrew, for your help. I appreciate it! :-) Jay
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
RE: subprocess question <jyoung79@kc.rr.com> - 2011-12-12 14:49 +0000
csiph-web