Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #86164
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.albasani.net!weretis.net!feeder4.news.weretis.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <mail@timgolden.me.uk> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.007 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'prefix': 0.09; 'true)': 0.09; '(it': 0.16; '22:06,': 0.16; 'complain,': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'here).': 0.16; 'message-id:@timgolden.me.uk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'tjg': 0.16; 'wrote:': 0.18; 'seems': 0.21; 'import': 0.22; 'shell': 0.22; 'header:User-Agent:1': 0.23; 'header:In-Reply- To:1': 0.27; 'tried': 0.27; "doesn't": 0.30; 'running': 0.33; 'but': 0.35; 'there': 0.35; 'doing': 0.36; 'hi,': 0.36; 'changing': 0.37; 'two': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; "you're": 0.61; 'email addr:gmail.com': 0.63; 'charset:windows-1252': 0.65; 'from:addr:mail': 0.83 |
| Date | Sun, 22 Feb 2015 22:14:24 +0000 |
| From | Tim Golden <mail@timgolden.me.uk> |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: calling subprocess |
| References | <edfc56d5-8696-49d0-8b71-69044bbab1f5@googlegroups.com> |
| In-Reply-To | <edfc56d5-8696-49d0-8b71-69044bbab1f5@googlegroups.com> |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://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 | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.19034.1424643312.18130.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1424643312 news.xs4all.nl 2838 [2001:888:2000:d::a6]:38877 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:86164 |
Show key headers only | View raw
On 22/02/2015 22:06, jkuplinsky@gmail.com wrote: > Hi, > > I thought this would be easy: > > > for subprocess import call call (['cd', r'C:\apps'], shell = True) > > > It doesn't work -- tried with/without prefix r, escaped backslashes, > triple quotes, str(), .. nothing seems to work (it doesn't complain, > but it doesn't change directories either) -- what am I doing wrong? Two things: 1) All you're doing is running up a subprocess, changing directory *within it* and then closing it. (Altho' good job spotting that you'd need shell=True if you did indeed want to do what you're doing here). 2) Use os.chdir: that's what it's there for TJG
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
calling subprocess jkuplinsky@gmail.com - 2015-02-22 14:06 -0800
Re: calling subprocess Tim Golden <mail@timgolden.me.uk> - 2015-02-22 22:14 +0000
Re: calling subprocess Chris Angelico <rosuav@gmail.com> - 2015-02-23 09:21 +1100
Re: calling subprocess jkuplinsky@gmail.com - 2015-02-22 17:13 -0800
Re: calling subprocess Chris Angelico <rosuav@gmail.com> - 2015-02-23 12:31 +1100
Re: calling subprocess Dave Angel <davea@davea.name> - 2015-02-22 21:38 -0500
Re: calling subprocess Dave Angel <davea@davea.name> - 2015-02-22 22:07 -0500
csiph-web