Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #38742
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <marduk@letterboxes.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.003 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'run,': 0.07; 'received:internal': 0.09; '(e.g.)': 0.16; 'echo': 0.16; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:mail.srv.osa': 0.16; 'received:messagingengine.com': 0.16; 'received:nyi.mail.srv.osa': 0.16; 'received:osa': 0.16; 'received:srv.osa': 0.16; 'ths': 0.16; 'wrote:': 0.17; 'shell': 0.18; '>>>': 0.18; 'feb': 0.19; 'import': 0.21; 'command': 0.24; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'to:addr:python-list': 0.33; "can't": 0.34; 'subject:?': 0.35; 'created': 0.36; '12,': 0.36; 'two': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; 'header:Message-Id:1': 0.62; 'different': 0.63 |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d=letterboxes.org; h=message-id:from:to:mime-version:content-transfer-encoding :content-type:in-reply-to:references:subject:date; s=mesmtp; bh= b+Z6W4VyGK9z8TY2MrlKxLvbrrk=; b=w6iX4wx0BIHrpS187bcxecl/5j+FI3A3 G5CLGS3J5ciRh1aQpJq88H2I0ufyno/8hhNEBijvHIWQsx9tbqxfLj5A38AykDad 2St+P0uxeggUVKLcetdL0ip+0fbvgAI1w++DNN3esiY9r7QrQMN8DgIBIzYsbzaE CSI9yHzvkUY= |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=b+Z6W4VyGK9z8TY2MrlKxLvbrrk=; b=cvT mk3ewt/Ny4HBR1dCN4c6edLUP2NV+uNqcdEXx9rj5pxnSG50lULI0Rs5Q+vzPGrs HHt4kD/WGkjFuOD8tZVufLPlFezo9xUiEeBSkTWjyKhC9ocXu6D9vhufmpNPo44J ow8nSdHUMc3NrnSqDZagZTgLzyG+8WKSItVLpA70= |
| X-Sasl-Enc | dUaar4q7dgg54iGvt5Chpsn4dkWaKhQohSniS3gjKhR4 1360667904 |
| From | Albert Hopkins <marduk@letterboxes.org> |
| To | python-list@python.org |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | 7bit |
| Content-Type | text/plain |
| X-Mailer | MessagingEngine.com Webmail Interface - ajax-bcb164fb |
| In-Reply-To | <CA+YdQ_6G8hmtHHNHen1XZeMsO+gp91xf4fdFO3bkefoq92OpMA@mail.gmail.com> |
| References | <CA+YdQ_6G8hmtHHNHen1XZeMsO+gp91xf4fdFO3bkefoq92OpMA@mail.gmail.com> |
| Subject | Re: how to call shell? |
| Date | Tue, 12 Feb 2013 06:18:24 -0500 |
| 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 | <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.1697.1360667913.2939.python-list@python.org> (permalink) |
| Lines | 33 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1360667913 news.xs4all.nl 6890 [2001:888:2000:d::a6]:54496 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:38742 |
Show key headers only | View raw
On Tue, Feb 12, 2013, at 12:12 AM, contro opinion wrote:
> >>> import os
> >>> os.system("i=3")
> 0
> >>> os.system("echo $i")
>
> 0
> >>>
> why i can't get the value of i ?
Whenever you call os.system, a new shell is created and the command is
run, system() then waits for the command to complete.
You don't see i because your two system() calls are in two different
processes:
python> import os
python> os.system('echo $$')
24294
0
python> os.system('echo $$')
24295
0
However, ths (e.g.) would work:
python> os.system('i=3; echo $i')
3
0
HTH,
-a
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: how to call shell? Albert Hopkins <marduk@letterboxes.org> - 2013-02-12 06:18 -0500
csiph-web