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


Groups > comp.lang.python > #50816

Re: Need help with network script

Path csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.041
X-Spam-Evidence '*H*': 0.92; '*S*': 0.00; 'string.': 0.05; 'sys': 0.07; 'subject:help': 0.08; 'subject:script': 0.09; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'macs': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'trying': 0.19; 'thu,': 0.19; 'code,': 0.22; 'import': 0.22; 'print': 0.22; '(a)': 0.24; 'looks': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; 'gives': 0.31; 'code': 0.31; 'crash': 0.31; 'selection': 0.32; 'run': 0.32; 'guess': 0.33; 'actual': 0.34; 'subject:with': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'everyone.': 0.36; 'doing': 0.36; 'wrong': 0.37; 'starting': 0.37; 'to:addr:python- list': 0.38; 'to:addr:python.org': 0.39; 'hope': 0.61; 'simple': 0.61; "you're": 0.61; 'back': 0.62; 'decided': 0.64; 'subject:Need': 0.64; 'here': 0.66; 'home': 0.69; 'jul': 0.74; '11:44': 0.84; 're-type': 0.84; '2013': 0.98
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=gHuBPX9dMxEghG8s/dM127mjCFM10OfG5/Ah91bqoCs=; b=WczlfEjlL7T4QkPfkn9W6reK2Syq7ne2s10bNkB4DH+iWRc8zLGvG1AEq7nohiBvr1 Ang8EYpaBmtxg5P3myfF4VIa+j5JaQspbnk9taiqd/ZcFtooRJwlX+CQgD2QXrpuMEFG RCZQhxau/Ba8NYqhtStXDIO4hkRcCM7SL02sz6OD22EP9es4hoRQVBtzVoiE97KCSyOq X2iPiIqFvWaQPpMTRAjKeaVcFpR+xnENqv0KJwUMZedgu5uFqrAKa1Ot2RIatsveYBy7 0HvKxK4CVNDuTW8St3ShCdEiU2lCBzjxOdX7Ed+vyw2r7YosV8ixcM1yxzW5bVN6Jljz SkGA==
MIME-Version 1.0
X-Received by 10.58.249.236 with SMTP id yx12mr3150580vec.25.1374112244794; Wed, 17 Jul 2013 18:50:44 -0700 (PDT)
In-Reply-To <c3e795f9-b195-4a51-99ff-9289f0277280@googlegroups.com>
References <c3e795f9-b195-4a51-99ff-9289f0277280@googlegroups.com>
Date Thu, 18 Jul 2013 11:50:44 +1000
Subject Re: Need help with network script
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
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.4820.1374112253.3114.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1374112253 news.xs4all.nl 15891 [2001:888:2000:d::a6]:39192
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:50816

Show key headers only | View raw


On Thu, Jul 18, 2013 at 11:44 AM,  <bbechdol@gmail.com> wrote:
> Hi everyone. I am starting to learn python and I decided to start with what I though was a simple script but I guess now. All I want to do is return what current network location I am using on my mac. Every time I run it, it gives me back a 0. I don't know what I am doing wrong so here is my code. I really hope some one can help me. This script is unique to MACS btw.
>
> import sys
> import subprocess
>
> loc = "scselect"
> srn = "scselect SRN"
> home = "scselect HOME"
>
> a = subprocess.call(loc, shell=True, stdout=subprocess.PIPE)
> b = subprocess.call(srn, shell=True, stdout=subprocess.PIPE)
> c = subprocess.call(home, shell=True, stdout=subprocess.PIPE)
>
> print "\n##### NETWORK SELECTION #####"
> print "\nYour current location is set to \n%s" (a)

Your last line here looks wrong. Is this really the code you're using?
This code will crash with a TypeError, because you're trying to call a
string.

Copy and paste your actual code, don't re-type it :)

ChrisA

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


Thread

Need help with network script bbechdol@gmail.com - 2013-07-17 18:44 -0700
  Re: Need help with network script Chris Angelico <rosuav@gmail.com> - 2013-07-18 11:50 +1000
    Re: Need help with network script bbechdol@gmail.com - 2013-07-17 18:59 -0700
      Re: Need help with network script bbechdol@gmail.com - 2013-07-17 19:01 -0700
      Re: Need help with network script Chris Angelico <rosuav@gmail.com> - 2013-07-18 15:38 +1000
  Re: Need help with network script Dave Angel <davea@davea.name> - 2013-07-17 22:06 -0400
    Re: Need help with network script bbechdol@gmail.com - 2013-07-17 19:19 -0700

csiph-web