[liblouis-liblouisxml] Re: Liblouis and python

  • From: Jake Kyle <jake@xxxxxxxxxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Mon, 21 Dec 2020 10:39:29 +0000

Hi

As a user of Liblouis in Python I had the same problem as Андрейevn when I tried to follow the instructions Christian suggests.

I therefore came up with a similar workaround to Andre. The main difference being that I edit the __init__.py.in file replacing ###LIBLOUIS_SONAME### to the path to liblouis.dll and saving it as __init__.py before running:
python setup.py install

Something I found out new in Python 3.8, for security I think, was that you have to put the full path to the DLL rather than relying on the PATH variable to find it.

Jake

On 21/12/2020 10:13, Christian Egli wrote:

Hi Андрей

When you run `make` it should modify the string ###LIBLOUIS_SONAME### to
the proper name of the dynamic library inside __init__.py. To be honest
I do not know if this works on windows.

As far as I know this should work if you use a tarball from the releases
page.

This code was provided by James Teh a long time ago (maybe 10 years?).
Someone who knows more about windows and the Python bindings should have
a look at this.

HTH
Christian

Андрей Якубой writes:

Hello everybody!

I'm sorry if my question is too stupid, but I'm absolutely know
nothing about programming with Liblouis at the moment. So what should
I do to use liblouis with Python? I've installed 'louis' from
Python-derrectory of the repo, but when I import it, I get such error:

     liblouis = _loader["###LIBLOUIS_SONAME###"]
   File
"C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py",
line 448, in __getitem__
     return getattr(self, name)
   File
"C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py",
line 443, in __getattr__
     dll = self._dlltype(name)
   File
"C:\Users\andre\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py",
line 373, in __init__
     self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module '###LIBLOUIS_SONAME###' (or
one of its dependencies). Try using the full path w
ith constructor syntax.

What should I install to fix it?

Thanks.

Andrey
For a description of the software, to download it and links to
project pages go to http://liblouis.org
Donate: http://liblouis.org/sponsoring

--
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland
For a description of the software, to download it and links to
project pages go to http://liblouis.org
Donate: http://liblouis.org/sponsoring

For a description of the software, to download it and links to
project pages go to http://liblouis.org
Donate: http://liblouis.org/sponsoring

Other related posts: