Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #72191

passing Python assignment value to shell

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <satish.muthali@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.026
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'example:': 0.03; 'argument': 0.05; 'subject:Python': 0.06; 'advance': 0.07; 'executed': 0.09; 'trying': 0.19; 'skip:f 30': 0.19; 'command': 0.22; 'memory': 0.22; 'this?': 0.23; 'pass': 0.26; 'skip:- 40': 0.29; '8bit%:3': 0.30; 'extract': 0.31; 'skip:s 30': 0.35; 'tool': 0.35; 'received:google.com': 0.35; 'doing': 0.36; 'thanks': 0.36; 'so,': 0.37; 'skip:- 20': 0.37; 'message-id:@gmail.com': 0.38; '8bit%:4': 0.38; 'feed': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; '8bit%:6': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'header:Message-Id:1': 0.63; 'charset:windows-1252': 0.65; 'received:148': 0.84; 'skip:\x91 10': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-type:subject:message-id:date:to:mime-version; bh=mZVBFmXr3Wyko7inkgwySzO1xbmmEl7oarWwki6bluE=; b=R34QYbHCtDIVayjvYEwka1rkNEeQUyatzQYr8IOnRkARGVdXZ9f+xx1xmMjPbbZl8/ x0hAwR3Z7s/li/cGR/n2wRKh6X0/xOMVxRsHc15upg+wTs1EL0tbpWG3+6IJQZv1tM9f 5eGv1MQl8xEGijqMO1FKDih9bAcKmzcxtCxv8EL4s0vts4jDbHFmqPmJ4/ozbc7j3aPM tdhs+pY0RQfRbHhnY3KXlAQCpHF8itS8XoGdY/6D9zUPyZaiM9i4nsDAFFxPN0E8o9ry ouDRaQfLhrz9vBmsuswnH8HtTTvMW+fI2kgfl8XBLlHQxCTBhF0GgBFx3V96B7VRjSJV fLqQ==
X-Received by 10.60.57.164 with SMTP id j4mr2840115oeq.24.1401308163519; Wed, 28 May 2014 13:16:03 -0700 (PDT)
From Satish Muthali <satish.muthali@gmail.com>
Content-Type multipart/alternative; boundary="Apple-Mail=_00A85545-A350-4883-B1D9-713BE333A9F8"
Subject passing Python assignment value to shell
Date Wed, 28 May 2014 13:16:00 -0700
To python-list@python.org
Mime-Version 1.0 (Mac OS X Mail 7.3 \(1878.2\))
X-Mailer Apple Mail (2.1878.2)
X-Mailman-Approved-At Wed, 28 May 2014 22:58:42 +0200
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.10422.1401310723.18130.python-list@python.org> (permalink)
Lines 66
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1401310723 news.xs4all.nl 2921 [2001:888:2000:d::a6]:55730
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:72191

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hello Experts,

I am trying to extract the available userspace+swap memory and then want to feed this value as an argument to a tool that is executed in the shell.

so, this is what I have so far:

reecalc = [s.split() for s in os.Popen("free -ht").read().splitlines()]
freecalc_total = freecalc[4]
freecalc_total = freecalc_total[3]
freecalc_total = freecalc_total.translate(None, 'M’)

Now I want to feed the value for ‘freecalc_total’ as an argument to a command executed by the shell.

For example:

devnull = open(os.devnull, “w”)
runCommand = subprocess.call([“stressapptest”, “<I want to pass the value of freecalc_total here>”, “20”],stdout=devnull,stderr=subprocess.STDOUT)
devnull.close()

How do I go about  doing this?

Many thanks in advance

-Satish

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

passing Python assignment value to shell Satish Muthali <satish.muthali@gmail.com> - 2014-05-28 13:16 -0700
  Re: passing Python assignment value to shell John Gordon <gordon@panix.com> - 2014-05-28 21:40 +0000

csiph-web