[Tutor] os.popen doesn't give up

Ben Vinger benvinger at yahoo.co.uk
Fri Dec 3 00:39:40 CET 2004


 --- Ben Vinger <benvinger at yahoo.co.uk> wrote: 
>  --- Bob Gailer <bgailer at alum.rpi.edu> wrote: 
> > Solutions:
> > 2 - l = os.popen(r'snmpget -Os -c ' +
> SNMPcommunity
> > + ' -v2c -r 3 ' + IP + 
> > ' ' + counter, 'r').read() Puts snmpget's output
> in
> > l.

Sorry, now I have doubts again.  Originally, I had:
I = os.popen(r'snmpget -Os -c ' + SNMPcommunity + ' -v
2c -r 3 ' + IP + ' ' + counter, 'r')
bytes = string.split(I.read(), None)[3]

With Bob's suggestion, I have:
I = os.popen(r'snmpget -Os -c ' + SNMPcommunity + ' -v
2c -r 3 ' + IP + ' ' + counter, 'r').read()
bytes = string.split(I, None)[3]

But is this really different?
I can add I.close() as you suggested, maybe that will
do the trick. 

Thanks
Ben



		
___________________________________________________________ 
Moving house? Beach bar in Thailand? New Wardrobe? Win £10k with Yahoo! Mail to make your dream a reality. 
Get Yahoo! Mail www.yahoo.co.uk/10k


More information about the Tutor mailing list