2

I am trying to load a .dll file using python cffi library, but whiele I am trying to load it I am getting following error:-

    *** OSError: cannot load library C:\WINDOWS\libzsfc.dll: error 0xc1

I am using this

from cffi import FFI
ffi = FFI()
lib = ffi.dlopen("libzsfc.dll")

but this giving me error, I tried a lot to resolve this, but it remains same, please let me know if anyone faced same issue.

Mahendra Garg
  • 516
  • 1
  • 9
  • 27

2 Answers2

1

I think you have to first register the dll in windows then load will work fine.

To register the same use command regsvr32 <complete dll path>

Use Regsvr32.exe from the %SystemRoot%\Syswow64 folder. For example, type the following commands to register the DLL: cd \windows\syswow64 regsvr32 c:\filename.dll

prashant thakre
  • 5,061
  • 3
  • 26
  • 39
  • I have followed this step, but It is not work... Any other idea? – Mahendra Garg Feb 10 '17 at 10:53
  • Did you try the `ctypes` ? For more info follow the link http://stackoverflow.com/a/252473 – prashant thakre Feb 10 '17 at 11:39
  • 1
    Both ctypes and cffi's ``dlopen`` function just call ``LoadLibrary()`` from the Windows API. If you get an error in one, I bet you get the same error in the other. I don't know Windows enough to help you fix it. It can be something like trying to load a 32-bit DLL into a 64-bit Python or vice-versa, or something completely different. – Armin Rigo Feb 10 '17 at 12:20
  • 2
    btw I find the solution for this issue, python2.7.13 64 bit required to load dll file. – Mahendra Garg Feb 14 '17 at 13:06
0

Old question, but I just had the same issue. Fixed:

Super easy - reinstall tessaract. Head over to https://github.com/UB-Mannheim/tesseract/wiki. Get their installer. It'll have you uninstall the old version. Worked immediately for me.

August
  • 1