rnso
rnso

Reputation: 24535

Python wrapper not working: swig_import_helper() error

This is related to Reading Dicom files in Dlang

I am trying Python wrapper for Imebra as shown in above post.

Python_wrapper.so is created by following command:

$ g++ -shared -o python_wrapper.so -fPIC -I../../library/include/ -I/usr/include/python3.5m -L../../build -limebra python_wrapper.cxx 

I try to load it with following simple python file:

import sys
sys.path.append('../../build')
from imebra import *            # does not work;  
# import imebra                 # also does not work; 

But I get following error:

$ python3 rnImebra.py 
Traceback (most recent call last):
  File "..../0-Imebra-dicom/wrappers/pythonWrapper/imebra.py", line 14, in swig_import_helper
    return importlib.import_module(mname)
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named '_imebra'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "rnImebra.py", line 5, in <module>
    import imebra                               #  also does not work; 
  File "..../0-Imebra-dicom/wrappers/pythonWrapper/imebra.py", line 17, in <module>
    _imebra = swig_import_helper()
  File "..../0-Imebra-dicom/wrappers/pythonWrapper/imebra.py", line 16, in swig_import_helper
    return importlib.import_module('_imebra')
  File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_imebra'

Where is the problem and how can it be solved?

Upvotes: 0

Views: 2268

Answers (1)

Paolo Brandoli
Paolo Brandoli

Reputation: 4750

After downloading the source distribution, just install the python library as explained in the user manual.

cd imebra
python setup.py install

or

cd imebra
python setup.py install --user

Upvotes: 1

Related Questions