etingof / pysnmp

Python SNMP library
http://snmplabs.com/pysnmp/
BSD 2-Clause "Simplified" License
576 stars 197 forks source link

Noob question #292

Open Cristianistrate opened 5 years ago

Cristianistrate commented 5 years ago

I intalled pysnmp and if I open an example ai get some errors when running: AttributeError: module 'pysnmp.carrier.asyncore.dgram.udp' has no attribute 'DOMAIN_NAME' or NameError: name 'USM_AUTH_HMAC96_SHA' is not defined

Please, tell me what I do wrong.

etingof commented 5 years ago

Could you share which pysnmp version you have installed and what example you trying to run?

Cristianistrate commented 5 years ago

listen-on-ipv4-and-ipv6-interfaces.py python 3.7.3. as for pysnmp i just pip installed a few minutes ago

etingof commented 5 years ago

I suspect you have taken the example from GitHub master (pysnmp 5.x.x), but installed pysnmp (4.4.10) from PyPI. Then you should take examples from release-4.4.10 branch.

Cristianistrate commented 5 years ago

Thanks, i will try to install 5

etingof commented 5 years ago

Just keep in mind that pysnmp 4 is stable, pysnmp 5 is still in development (though it should work).

Cristianistrate commented 5 years ago

Ok. Thanks.

Cristianistrate commented 5 years ago

One more think, when i run the example provided by you above a got this error (127.0.0.1): WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions

when I put a printer IP isnotead of 127....: [WinError 10049] The requested address is not valid in its context

etingof commented 5 years ago

I think the system prevents you from binding port 161 unless you are a superuser.

Printer IP perhaps is a remote IP, you can only listen on local IP interfaces.

You may try ('0.0.0.0', 1024), that should avoid both of the above mentioned problems.

safadig commented 2 years ago

You can also change DOMAIN_NAME to domainName in the code.