[Tutor] os.popen doesn't give up
Ben Vinger
benvinger at yahoo.co.uk
Thu Dec 2 19:17:28 CET 2004
--- Bob Gailer <bgailer at alum.rpi.edu> wrote:
> Solutions:
> 1 - os.popen(r'snmpget -Os -c ' + SNMPcommunity + '
> -v2c -r 3 ' + IP + ' '
> + counter, 'r'). Discards (therefore closes) the
> file object.
> 2 - l = os.popen(r'snmpget -Os -c ' + SNMPcommunity
> + ' -v2c -r 3 ' + IP +
> ' ' + counter, 'r').read() Puts snmpget's output in
> l.
> 3 - l = os.popen(r'snmpget -Os -c ' + SNMPcommunity
> + ' -v2c -r 3 ' + IP +
> ' ' + counter, 'r')
> l.close()
Thanks Bob. 1 is no solution, because I need to do
something with the output of net-snmp, so I've opted
for 2.
Robert I originallyly had a brief look at pysnmp, but
couldn't get my head around it within the allocated
time (3 minutes). But maybe I'll use that in future.
___________________________________________________________
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