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: 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 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 --Apple-Mail=_00A85545-A350-4883-B1D9-713BE333A9F8 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 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 =3D [s.split() for s in os.Popen("free = -ht").read().splitlines()] freecalc_total =3D freecalc[4] freecalc_total =3D freecalc_total[3] freecalc_total =3D freecalc_total.translate(None, 'M=92) Now I want to feed the value for =91freecalc_total=92 as an argument to = a command executed by the shell. For example: devnull =3D open(os.devnull, =93w=94) runCommand =3D subprocess.call([=93stressapptest=94, =93=94, = =9320=94],stdout=3Ddevnull,stderr=3Dsubprocess.STDOUT) devnull.close() How do I go about doing this? Many thanks in advance -Satish= --Apple-Mail=_00A85545-A350-4883-B1D9-713BE333A9F8 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=windows-1252 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 =3D = [s.split() for s in os.Popen("free = -ht").read().splitlines()]
freecalc_total =3D = freecalc[4]
freecalc_total =3D = freecalc_total[3]
freecalc_total =3D = freecalc_total.translate(None, = 'M=92)

Now I want = to feed the value for =91freecalc_total=92 as an argument to a = command executed by the shell.

For = example:

devnull =3D open(os.devnull, = =93w=94)
runCommand =3D subprocess.call([=93stressapptest=94, = =93<I want to pass the value of freecalc_total here>=94, = =9320=94],stdout=3Ddevnull,stderr=3Dsubprocess.STDOUT)
devnull.c= lose()

How do I go about  doing = this?

Many thanks in = advance

-Satish
= --Apple-Mail=_00A85545-A350-4883-B1D9-713BE333A9F8--