pythonpysnmp

Python doesn't see installed module entity.rfc3413.oneliner


thank you in advance for help.

Here is an issue, I use module pysnmp with pyasn1, I am using this example to get started, and getting an error:

# python snmp.py
Traceback (most recent call last):
File "snmp.py", line 1, in <module>
from pysnmp.entity.rfc3413.oneliner import cmdgen
File "/home/user_name/rrd_poller/pysnmp.py", line 5, in <module>
ImportError: No module named **entity.rfc3413.oneliner**

Other question is why it refers to entity.rfc3413.oneliner but not to pysnmp.entity.rfc3413.oneliner . Also, I checked

/usr/local/lib/python2.7/site-packages/pysnmp/entity/rfc3413/oneliner/__init__.py

These server has two versions of python installed one is in /usr/bin/ other in /opt, When I do:

which python

I get:

/opt/python/python/Python-2.7.5/python # which is correct location

Modules are installed:

#python -c "help ('modules')"

Gives:

pysnmp and pyasn1

Solution

  • Looks like Python tries to resolve your module (pysnmp.py) as top-level pysnmp package component so it can't get past it to reach 'entity' sub-package which is absent in your module. That's why renaming your script to a non-conflicting name might help.