Error on pysnmp and/or BER Module in Python2.2
heinl raimund
heinlr at gmx.de
Sat Mar 2 12:34:33 EST 2002
i am using : Python 2.2 (#28, Dec 21 2001, 12:21:22) [MSC 32 bit (Intel)] on
win32
i use the pysnmp modul. for coding and encoding of
snmp packets pysnmp uses the BER Modul.
on function call to MyPySnmp_session.decode_value i got the following
error:
session instance has no attribute
'decode_an_unsigned'-exceptions.AttributeError
is it a known bug - maybe a fixed BER/pysnmp Modul already exists ?
best regards
### CODE SNIPPLET
session = pysnmp.session(agent, community) # create a SNMP
session
#the session is always not NONE - its not possible at this point to
validate a password
for objid in lobjid: # encode objids
#DBG(DBG_SNMPLO, "snmpget: %s + %s ", objid, poid)
encoded_oids.append(session.encode_oid(session.str2nums(objid+poid)))
# build a packet
packet = session.encode_request ('GETREQUEST', encoded_oids,
encoded_vals)
# send SNMP request and receive a response
packet = session.send_and_receive (packet)
if packet == None: # if None stop condition occured
return (-2, None)
# parse a response packet
(encoded_oids, encoded_vals) = session.decode_response (packet)
index = 0
while index < len(encoded_oids): # decode objs & vals
objid = session.decode_value(encoded_oids[index])
# in Python2.2 an !!!!!!!!!!! ERROR !!!!!!!!!!!!!
# session instance has no attribute
'decode_an_unsigned'-exceptions.AttributeError
value = session.decode_value(encoded_vals[index])
lval.append(value)
if lprivoid != None:
pos = string.find(objid, lobjid[index])
#DBG(DBG_SNMPLO, "snmpget:oidfind %s,%s:%d", objid,
lobjid[index], pos)
if pos != 0: # OID not at begin or not
found
privoid = objid # return complete ???
else: # ok strip requested OID
pos = len(lobjid[index])
privoid = objid[pos:] # return private
part
lprivoid.append(privoid)
index = index + 1 # go to the next objid
if CallBackRead != None: CallBackRead(0)
return (index, None)
--
===========================================================
Heinl Raimund SSH - Software Systeme Heinl
gepr.Wirtschaftsinformatiker IHK Am Galling 3
91217 Hersbruck
Email: heinlr at gmx.de
===========================================================
More information about the Python-list
mailing list