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


Groups > comp.lang.python > #50816

Re: Need help with network script

References <c3e795f9-b195-4a51-99ff-9289f0277280@googlegroups.com>
Date 2013-07-18 11:50 +1000
Subject Re: Need help with network script
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4820.1374112253.3114.python-list@python.org> (permalink)

Show all headers | 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