matiasb / python-unrar

A ctypes wrapper for UnRAR library, plus a rarfile module on top of it.
http://python-unrar.readthedocs.org/en/latest/
GNU General Public License v3.0
74 stars 30 forks source link

Couldn't find path to unrar library #8

Open DeusMaximus opened 9 years ago

DeusMaximus commented 9 years ago

I'm trying desperately to get a Python app working that uses your python-unrar script. I've downloaded the sources from Rarlabs, installed the compiled libunrar.so into /usr/lib, and even set the goddamn UNRAR_LIB_PATH to /usr/lib and pip uninstalled and installed unrar half a dozen times, and goddamnit it still doesn't work.

What the hell is going wrong?

DeusMaximus commented 9 years ago

Managed to resolve this by doing the following (found on some obscure Spanish page):

sudo ln -s /usr/lib/libunrar.so /usr/local/bin/

Is there a reason why this script looks for system libraries in the system binary folder?

matiasb commented 9 years ago

It uses Python's ctypes find_library helper (https://docs.python.org/2/library/ctypes.html#finding-shared-libraries), that is supposed to locate a library in a way similar to what the compiler does. I can check if there is a better way, though.

On the other hand, if setting UNRAR_LIB_PATH, it should be the full path to the file (including the filename): UNRAR_LIB_PATH=/usr/lib/libunrar.so I agree this ^ could be clearer in the docs, will update.

philborman commented 6 years ago

A bit late, this is an old thread, but after building/installing libunrar with make lib; make install-lib you might also need to run ldconfig so it finds the new library

ntaherkhani commented 4 years ago

Hi, I am trying to use python_unrar on mac . after downloading unrar_MacOSX_10.13.2_64bit image I set the UNRAR_LIB_PATH in .bash_profile . to fix of the issue for finding the lib path. then in from unrar import rarfile line I am getting the following error AttributeError: dlsym(0x1131589b0, RARGetDllVersion): symbol not found. I put the libunrar.so in /usr/local/bin folder as well. may some one have any clue? thanks