https://github.com/n-y-kim/liblouis-python
how to use liblouis in Python
https://github.com/n-y-kim/liblouis-python
braille liblouis python translation
Last synced: 5 months ago
JSON representation
how to use liblouis in Python
- Host: GitHub
- URL: https://github.com/n-y-kim/liblouis-python
- Owner: n-y-kim
- Created: 2021-09-20T12:37:41.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-11-26T07:20:57.000Z (almost 3 years ago)
- Last Synced: 2025-05-12T08:09:40.498Z (5 months ago)
- Topics: braille, liblouis, python, translation
- Language: Python
- Homepage:
- Size: 195 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# How to use: Added by @n-y-kim
‼️DO NOT DOWNLOAD OR CLONE THIS REPO! THIS IS READ ONLY FOR PYTHON USERS‼️
- Download the most recent release version from liblouis repo.(zip file)
- Check your environment.
import louis
is not supportable atarm64
architecture(v 3.21.0). Onlyx86_64
would be able to get the correct path.
- Unzip your installed file.
- RUN
./configure
- RUN
make
- RUN
sudo make install
- Move to python folder and RUN
python setup.py install
- You would be able to
import louis
and test.
EXAMPLE:
``` python
import louis
print(louis.translateString(["braille-patterns.cti", "en-us-g2.ctb"], "Hello, World!"))
#⠠⠓⠑⠇⠇⠕⠂⠀⠠⠸⠺⠖
print(louis.backTranslateString(["braille-patterns.cti", "en-us-g2.ctb"], "⠓⠑⠇⠇⠕"))
#hello
```## If you have this problem(issue #990)(cython OSError), follow these steps:
(I got this error when I tried deploying web server, nginx & gunicorn on Ubuntu)
- Go to
~/python/louis/__init__.py
- Add function
CDLL
insidefrom ctypes import ~
- Fix line 61:
``` python
import os
path_f = os.path.abspath( os.path.join(os.path.dirname(__file__), "liblouis.so.20"))
liblouis = CDLL(path_f)
```
- RUN
python setup.py install
again
- Go to
/usr/local/lib
(your library file) and check ifliblouis.so.20
andliblouis.a
exist
- Copy those files to your python
louis
package folder. For example, my conda environments are:/home/ubuntu/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/louis/
. So I usedcp
commands to copy.
``` shell
cp -a liblouis* /home/ubuntu/anaconda3/envs/pytorch_latest_p37/lib/python3.7/site-packages/louis/
```
- Now it should work! :)