Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.088 X-Spam-Evidence: '*H*': 0.82; '*S*': 0.00; 'absent': 0.09; 'echo': 0.16; 'to:name:python-list@python.org': 0.20; 'import': 0.21; 'posted': 0.22; 'header:In-Reply-To:1': 0.25; 'realize': 0.27; 'message-id:@mail.gmail.com': 0.27; '>>>>': 0.29; 'attempting': 0.29; 'surprised': 0.29; 'starts': 0.29; 'problem': 0.33; 'to:addr :python-list': 0.33; 'received:google.com': 0.34; 'open': 0.35; 'why': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'think': 0.40; 'days': 0.60; 'close': 0.63; 'mentioned': 0.63 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=LWDKNHPa1AF2dXKC6cx1d20yonaj7Bq2CnhsksdbjHM=; b=E0a/C1T+TXo8xxtt7pQpV9QdL8FRAPj8HrgAX+NGG8k4KZhxg9F65e/7KqCO85L1Sd r+D34bwiM/EtaxeXqKFCO+s2PQuWeD224eFOftPXI2nWIlSIN1SV4abpvyyY8Ru9qfLx tNUvK1At1ERuZzAXjiJzz+h79j2Pij6Sw4CA3YGmC08W4NorV+uGGjlHTlzKAoVWr39f 4onQEev2jedIb65IlaZwrrfNQGCq3Utm268eAZGqDLw9rnVefOj78GN9pFcxZNCyC7UK bIL169MOLJqzrifCeYUpXmE31UX+ZnHX+1W+9HiVDIsZO05H2c5TGhNKraF7eUfde+Z8 g+nw== MIME-Version: 1.0 X-Received: by 10.50.170.2 with SMTP id ai2mr4717602igc.104.1361084423356; Sat, 16 Feb 2013 23:00:23 -0800 (PST) In-Reply-To: <1360647500.45284.YahooMailNeo@web160602.mail.bf1.yahoo.com> References: <1360647500.45284.YahooMailNeo@web160602.mail.bf1.yahoo.com> Date: Sun, 17 Feb 2013 00:00:23 -0700 Subject: Re: call from pthon to shell From: Jason Friedman To: "Python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1361084432 news.xs4all.nl 6980 [2001:888:2000:d::a6]:52686 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:39015 >>>> import os >>>> os.system("i=3") > 0 >>>> os.system("echo $i") > > 0 > > why i can not get the value of i? Each call to os.system starts a new shell. Think about what would happen if you opened a terminal and typed: $ i=3 Then, close that terminal and open a new one. You would not be surprised that $ echo $i returns nothing. And, as mentioned by Andrew, even absent that problem os.system is not the way to obtain the data you are looking for. I realize this is now 5 days after you posted ... what were you ultimately attempting to accomplish?