Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in doc #465

Closed
cmarmonier opened this issue Sep 25, 2024 · 2 comments
Closed

Error in doc #465

cmarmonier opened this issue Sep 25, 2024 · 2 comments

Comments

@cmarmonier
Copy link

Code exemple in documentation is wrong for getCmd : https://pysnmp.readthedocs.io/en/latest/quick-start.html

It should be :
`from pysnmp.hlapi import *

data = (
ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysLocation', 0)),
ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)),
)

iterator = getCmd(
SnmpEngine(),
CommunityData('public', mpModel=0),
UdpTransportTarget(('demo.snmplabs.com', 161)),
ContextData(),
*data
)

#errorIndication, errorStatus, errorIndex, varBinds = next(iterator) # wrong doc
errorIndication, errorStatus, errorIndex, varBinds = iterator # fix

if errorIndication:
print(errorIndication)

elif errorStatus:
print('%s at %s' % (errorStatus.prettyPrint(),
errorIndex and varBinds[int(errorIndex) - 1][0] or '?'))

else:
for varBind in varBinds:
print(' = '.join([x.prettyPrint() for x in varBind]))
`

@lextm
Copy link

lextm commented Sep 25, 2024

That's the wrong place to learn this project. Please use https://pysnmp.com

Read #429 to learn more.

@cmarmonier
Copy link
Author

Ok, I close this thread

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants