no module named error

Diez B. Roggisch deets at nospam.web.de
Thu Dec 10 10:45:06 EST 2009


Joe wrote:

>> No, the import-mechanism of python doesn't take LD_LIBRARY_PATH into
>> account, and even if it did - _moda.la is a simple archive-file, not a
>> shared library. It can't be dynamically loaded. Something in your
>> build-process is not working.
> 
> So how should my stuff find these libs?
> 
> Here's what I've recently learned ...
> 
> So if I have the dir path of my c libs inside my exported
> LD_LIBRARY_PATH (which includes the following files),  along w/ the dir
> to the *.la file ...
> 
> _moda.a
> _moda.la -> ../_moda.la
> _moda.lai
> _moda.so -> _moda.so.2.0.1
> _moda.so.2 -> _moda.so.2.0.1
> _moda.so.2.0.1
> _moda.so.2.0.1T
> _moda_la-moda_wrap.o
> 
> I get the 'ImportError: No module named _moda' error as in previous
> post. But as I think your saying above, this should not work because
> LD_LIBRARY_PATH doesn't get used.
> 
> I was at the python command line '>>>' and I did the following command.
> 
> import sys
> sys.path.append('/home/me/my/c/libs/path/.libs')
> # this is the path to the above listed files, and then when I did ...
> 
>    import moda
> 
> Everything worked just fine.
> 
> But I'm not quite sure how to fix it in my script or env.

Your installation process is botched (no idea why, you don't show us
setup.py or anything else I asked for).


All that is missing is what I've asked you now several times before:
_moda.so is *NOT* alongside moda.py inside your python's site-packages
directory. Copy it in there, and the import will work *without* any
sys.path-hackery.

Of course you shouldn't do this by hand every time you need to, but instead
fix the whole package do to this when 

  python setup.py install

is invoked.

Diez



More information about the Python-list mailing list