ImportError: No shared library could be loaded, make sure that librtmp is installed
Question: I am using Windows 8, and trying to work with python-librtmp. I have followed
the steps to install librtmp from here: `http://pythonhosted.org/python-
librtmp/`. For me, the two pip install lines worked successfully when run in
Windows Powershell. After installation, it says the libraries are in
`c:\python27\lib\site-packages`.

Now, I have opened a Python IDE (IDLE), and typed in `import librtmp`. This is
giving me the following error:

    
    
    Traceback (most recent call last):
      File "<pyshell#1>", line 1, in <module>
        import librtmp
      File "C:\Python27\lib\site-packages\librtmp\__init__.py", line 14, in <module>
        from librtmp_ffi.binding import librtmp
      File "C:\Python27\lib\site-packages\librtmp_ffi\binding.py", line 13, in <module>
        raise ImportError("No shared library could be loaded, "
    ImportError: No shared library could be loaded, make sure that librtmp is installed.
    

The binding.py file:

    
    
    import librtmp_config
    
    from .ffi import ffi
    from .verifier import verifier
    
    for path in librtmp_config.library_paths:
        try:
            librtmp = ffi.dlopen(path)
            break
        except OSError:
            pass
    else:
        raise ImportError("No shared library could be loaded, "
                          "make sure that librtmp is installed.")
    
    librtmp = verifier.load_library()
    

The _init_.py file in librtmp_config folder:

    
    
    """Runtime configuration of python-librtmp.
    
       This module provides access to variables used by this library
       and makes it possible to customize some behaviour before :mod:`librtmp`
       is imported.
    
    """
    __all__ = ["library_paths"]
    
    #: This is a list of filenames that python-librtmp
    #: will attempt to dynamically load `librtmp` from.
    library_paths = ["librtmp.so", "librtmp.so.0", "librtmp.dll", "librtmp.so.1", "librtmp.dylib"]
    

I am pretty new to Python, and this is the first time I am using Python in
Windows. When I installed librtmp, it said installation is successful. I
exactly followed the steps in the above link. I cannot understand, then why it
is saying `make sure that librtmp is installed`.

Is it some path issue or installation issue? I search for a solution online,
but nothing helped.

Do I need to install librtmp separately? After some reading I found, librtmp
is present in rtmpdump. I have downloaded rtmpdump zip file from windows. But
I don't know how to install it. README says, run "make SYS=mingw", but the zip
folder has no makefile!

But there is one subfolder in the rtmpdump folder. That folder contains
librtmp.dll. If you see above, the _init_.py mentions one librtmp.dll in its
library path. Does this mean, I have to refer to this .dll in the _init_.py.
But I don't know how to do that.

Can you please help?


Answer: Resolved!!! I copied `librtmp.dll` file from the rtmpdump package into
`C:\Python27\DLLs`. From the `binding.py` and the `_init_.py` file content I
figured, python is unable to locate the dll file. But, still I don't know why
it could locate the file in the DLLs folder. I just tried it randomly, and it
worked!

If anyone of you can explain the logic it would be great!

