Question

I am experiencing a very strange issue using Eclipse and PyDev (latest versions as of this post). This is with Python 3.3.2. I installed the egg for PySNMP which was successful, however in PyDev, my program errors out with this import statement:

from pysnmp.entity.rfc3413.oneliner import cmdgen

This is the Traceback:

Traceback (most recent call last):
  File "<frozen importlib._bootstrap>", line 1521, in _find_and_load_unlocked
AttributeError: 'module' object has no attribute '__path__'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/alester/workspace/PySNMP Test/pysnmp.py", line 6, in <module>
    from pysnmp.entity.rfc3413.oneliner import cmdgen
  File "/home/alester/workspace/PySNMP Test/pysnmp.py", line 6, in <module>
    from pysnmp.entity.rfc3413.oneliner import cmdgen
ImportError: No module named 'pysnmp.entity'; pysnmp is not a package

On the last line, you can see it says that pysnmp is not a package. This is false, and the python interpreter in PyDev is properly configured to reference all the libraries.

If I go to a terminal and run "python3.3", I can enter that exact same import statement without error.

Does anybody know how I might fix this? :(

Was it helpful?

Solution

The problem seems to be that you're naming your module (pysnmp) with the same name of the package you want to use (pysnmp).

So, renaming your module should fix the error...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top