pynids (nids) import error using python3

I have installed pynids (pynids-0.6.3) on a Raspberry Pi v.2 running Jessie Light from in directory /usr/local/share/pynids-0.6.3 as follows: `

cd /usr/local/share/pynids-0.6.3 python3 setup.py build python3 setup.py install python setup.py install ` 

The installation went ok for both python2 and python3 as far as I can tell:

~> pip show pynids --- Name: pynids Version: 0.6.3 Location: /usr/local/lib/python2.7/dist-packages Requires: ~> pip3 show pynids --- Name: pynids Version: 0.6.3 Location: /usr/local/lib/python3.4/dist-packages Requires: 

The nids modules are located where I think they should:

~> find /usr/local/lib -name nids* /usr/local/lib/python3.4/dist-packages/nidsmodule.cpython-34m.so /usr/local/lib/python2.7/dist-packages/nidsmodule.so 

Importing nids in python2 also works fine:

~> python Python 2.7.9 (default, Mar 8 2015, 00:52:26) [GCC 4.9.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import nids >>> 

But when trying to import nids in python3 I get an import error saying there is no nids module:

~> python3 Python 3.4.2 (default, Oct 19 2014, 13:31:11) [GCC 4.9.1] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import nids Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named 'nids' >>> 

What can be the problem?

1 Answer

Problem solved! It was a bug in setup.py

In setup.py in /usr/local/share/pynids-0.6.3 the name/text "nidsmodule" were changed to "nids". Now import works also in Python3.

 ext_modules = [ Extension( "nids", #"nidsmodule", define_macros = [ #("DEBUG", None), #("ENABLE_TCPREASM_DEBUG", None), ("ENABLE_TCPREASM", None), ], sources=["nidsmodule.c"], include_dirs = INCLUDE_DIRS, libraries = ["pcap", "net", "glib-2.0", "gthread-2.0"], library_dirs = LIBRARY_DIRS, extra_objects = EXTRA_OBJECTS ) ], url = "" ) 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like