Hi Andrey,
Here's my installation of liblouis on Windows:
- cloned the liblouis repository in "D:/src/liblouis/liblouis".
- installed liblouis in "D:/app/liblouis"
- added "D:/app/liblouis/bin" to the PATH environment variable.
- added the environment variable LOUIS_TABLEPATH with value
"D:/src/liblouis/liblouis/tables"
- copied "D:/src/liblouis/liblouis/python/louis/__init__.py.in" to
"C:/Python/3.9/Lib/louis.py"
- (in louis.py) replaced "###LIBLOUIS_SONAME###" by
"D:/app/liblouis/bin/liblouis.dll".
Works fine, but There's probably better ways to do it :)
Small demo:
|Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64
bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license"
for more information. >>> import louis >>> louis <module 'louis' from
'C:\\Python\\3.9\\lib\\louis.py'> >>> louis.version() '3.16.1' >>> s =
"Just a test: 123, foo bar." >>> louis.translate(["en-us-g1.ctb"], s,
None, 0, louis.dotsIO|louis.ucBrl) ('⠠⠚⠥⠎⠞⠀⠰⠁⠀⠞⠑⠎⠞⠒⠀⠼⠁⠃⠉⠂⠀⠋⠕⠕⠀⠃⠁⠗⠲', [0,
0, 1, 2, 3, 4, 5, 5, 6, 7, 8, 9, 10, 11, 12, 13, 13, 14, 15, 16, 17, 18,
19, 20, 21, 22, 23, 24, 25], [0, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13,
14, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28], 0) >>> res =
louis.translateString(["en-us-g1.ctb"], s, None,
louis.dotsIO|louis.ucBrl) >>> print(res) ⠠⠚⠥⠎⠞⠀⠰⠁⠀⠞⠑⠎⠞⠒⠀⠼⠁⠃⠉⠂⠀⠋⠕⠕⠀⠃⠁⠗⠲
>>> louis.backTranslateString(["en-us-g1.ctb"], res) 'Just a test: 123,
foo bar.' >>> |
HTH,
André
On 2020-12-18T22:48:31+0100, Андрей Якубой <andrewia2002@xxxxxxxxx> wrote:
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