Need help with network script

Chris Angelico rosuav at
Thu Jul 18 03:50:44 CEST 2013

On Thu, Jul 18, 2013 at 11:44 AM,  <bbechdol at> 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 =, shell=True, stdout=subprocess.PIPE)
> b =, shell=True, stdout=subprocess.PIPE)
> c =, 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

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


More information about the Python-list mailing list