Re: [Tutor] updating Unix config file

2009-10-20 Thread Dave Angel
Matt Herzog wrote: On Tue, Oct 20, 2009 at 02:49:53PM +, Tiago Saboga wrote: On Tue, Oct 20, 2009 at 2:44 PM, Matt Herzog wrote: Yes, thanks. What failed was the invocation of PIPE. Apparently I had to explicitly import PIPE from subprocess or python had no clue as to what PIPE

Re: [Tutor] updating Unix config file

2009-10-20 Thread Matt Herzog
On Tue, Oct 20, 2009 at 07:53:17AM -0700, Steve Willoughby wrote: > On Tue, Oct 20, 2009 at 10:44:16AM -0400, Matt Herzog wrote: > > Yes, thanks. What failed was the invocation of PIPE. Apparently I had to > > explicitly import PIPE from subprocess or python had no clue as to what > > PIPE was!

Re: [Tutor] updating Unix config file

2009-10-20 Thread Matt Herzog
On Tue, Oct 20, 2009 at 02:49:53PM +, Tiago Saboga wrote: > On Tue, Oct 20, 2009 at 2:44 PM, Matt Herzog wrote: > > Yes, thanks. What failed was the invocation of PIPE. Apparently I had to > > explicitly import PIPE from subprocess or python had no clue as to what > > PIPE was! > > > > Dare

Re: [Tutor] updating Unix config file

2009-10-20 Thread Kent Johnson
On Tue, Oct 20, 2009 at 10:44 AM, Matt Herzog wrote: > Yes, thanks. What failed was the invocation of PIPE. Apparently I had to > explicitly import PIPE from subprocess or python had no clue as to what PIPE > was! > > Dare I say, "wtf?" since when fo I have to specify such? Shouldn't importing

Re: [Tutor] updating Unix config file

2009-10-20 Thread Steve Willoughby
On Tue, Oct 20, 2009 at 10:44:16AM -0400, Matt Herzog wrote: > Yes, thanks. What failed was the invocation of PIPE. Apparently I had to > explicitly import PIPE from subprocess or python had no clue as to what PIPE > was! > > Dare I say, "wtf?" since when fo I have to specify such? Shouldn't im

Re: [Tutor] updating Unix config file

2009-10-20 Thread Tiago Saboga
On Tue, Oct 20, 2009 at 2:44 PM, Matt Herzog wrote: > Yes, thanks. What failed was the invocation of PIPE. Apparently I had to > explicitly import PIPE from subprocess or python had no clue as to what PIPE > was! > > Dare I say, "wtf?" since when fo I have to specify such? Shouldn't importing >

Re: [Tutor] updating Unix config file

2009-10-20 Thread Matt Herzog
On Tue, Oct 20, 2009 at 08:29:59AM +0100, Alan Gauld wrote: > "Matt Herzog" wrote > > >Anyway, I'd like a hint as to how I could convert this: > > > >ifcfg_lines = os.popen("/sbin/ifconfig fxp0").readlines() > >x = string.split(ifcfg_lines[3])[1] > > > >to the subprocess module. The os module is

Re: [Tutor] updating Unix config file

2009-10-20 Thread Alan Gauld
"Matt Herzog" wrote Anyway, I'd like a hint as to how I could convert this: ifcfg_lines = os.popen("/sbin/ifconfig fxp0").readlines() x = string.split(ifcfg_lines[3])[1] to the subprocess module. The os module is going away, right? The os module is not going away although the popen functio

Re: [Tutor] updating Unix config file

2009-10-19 Thread Matt Herzog
On Mon, Oct 19, 2009 at 07:51:06PM -0400, Matt Herzog wrote: > On Mon, Oct 19, 2009 at 08:07:47PM +0100, Alan Gauld wrote: > > > > "Matt Herzog" wrote > > > > >remembered that strings are immutable. > > >So how was I able to change the strings for my dotted quad? > > > > You didn't. > > > >

Re: [Tutor] updating Unix config file

2009-10-19 Thread Matt Herzog
On Mon, Oct 19, 2009 at 08:07:47PM +0100, Alan Gauld wrote: > > "Matt Herzog" wrote > > >remembered that strings are immutable. > >So how was I able to change the strings for my dotted quad? > > You didn't. > > >LASTKNOWN = '173.48.204.168' > > lns = cf.readlines() > > lns = "".join(lns)

Re: [Tutor] updating Unix config file

2009-10-19 Thread Alan Gauld
"Matt Herzog" wrote remembered that strings are immutable. So how was I able to change the strings for my dotted quad? You didn't. LASTKNOWN = '173.48.204.168' lns = cf.readlines() lns = "".join(lns) lns = re.sub(LASTKNOWN, CURRENT, lns) I assume this is the line in question? s