You are not logged in.
Pages: 1
I'n unable to find the "role"-object for a script I'm adapting from debian to arch. In debian that object seems to be in module pysnmp, in arch it is not, or so it seems. Where might that object be in arch?
The original script says:
from pysnmp import roleOffline
pysnmp is in the AUR, did you try installing that?
Offline
I had installed it from AUR. I tried to say above that python-pysnmp -packet does not include object "role". Or at least I can't find it :-(
Offline
Any chance we are mixing Python 2 and Python 3?
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way
Online
I've tried to search both. Can you show that either has role-object?
Offline
I've tried to search both. Can you show that either has role-object?
He means you should try running the script with python2 if you've only tried it with python (which is a symlink to python3, unlike on other distros).
Last edited by jakobcreutzfeldt (2014-03-14 17:29:09)
Offline
Yes, tried python2, too. No success.
Offline
Here I read that the PySNMP API has changed in the 3.x versions and that the role object was affected, it seems... If that was the case, I guess the AUR package you installed is just the Python 3.x one (python-pysnmp), not the Python 2.x one. Try installing python2-pysnmp from the AUR to get PySNMP 2.x and then running your script with python2.
Last edited by nvteighen (2014-03-20 11:04:29)
Offline
Thanks for your suggestion. The main problem is, I think, that I'm totally newbie with python and even if python2-pysnmp includes the role-object, I'm unable to find the correct way to load it :-(
I may have made a mistake not for presenting information enough in the beginning, but I thought my question would be a trivial one.
My environment
$ pacman -Q python2 python2-pysnmp
python2 2.7.6-3
python2-pysnmp 4.2.3-2http://pysnmp.sourceforge.net/examples/2.x/snmpget.html says you should do:
>>> from pysnmp import asn1, v1, v2c
>>> from pysnmp import rolebut in reality(?) that won't work and you have to do
>>> from pysnmp.proto.api import v1, v2cBut for loading role, I have not found a working way
>>> from pysnmp import role
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name role
>>> from pysnmp.mapping.udp import role
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named mapping.udpOffline
You have pysnmp v 4.2.5, not 2.x so it probably has different classes.
Edit: I guess using snmp should have vecome easier: http://pysnmp.sourceforge.net/examples/ … t-v2c.html
Last edited by progandy (2014-03-21 13:15:55)
| alias CUTF='LANG=en_XX.UTF-8@POSIX ' | alias ENGLISH='LANG=C.UTF-8 ' |
Offline
Pages: 1