Open ayushjainrksh opened 5 years ago
It would build from source properly with default langNames but there is an issue with tornado but that's a separate issue. Please check out this PR.
This doesn't seem to be getting the correct path when I use pip3 install .
. e.g:
$ apertium-apy --help | grep lang-names -A 3
-l LANG_NAMES, --lang-names LANG_NAMES
path to localised language names sqlite database
(default = /usr/local/lib/python3.7/site-
packages/langNames.db)
$ stat /usr/local/lib/python3.7/site-packages/langNames.db
stat: /usr/local/lib/python3.7/site-packages/langNames.db: stat: No such file or directory
Yeah there's a problem. I looked in my system directories and didn't understand why is langNames.db
in /usr/local/share/apertium-apy
while apertium_apy
installation is in /usr/local/lib/python3.7/site-packages/
?
https://github.com/apertium/apertium-apy/blob/master/setup.py#L68. There's probably a different pkg_resources
or pkgutil
method to get a path to a data file.
Please check if it works for you.
This is way too hardcoded and will almost certainly fail depending on how the installation is done.
Should I find another way/package for finding path for datafiles in python?
The problem is we are looking for apertium_apy installation and datafile is not present in the same folder
Should I find another way/package for finding path for datafiles in python?
https://github.com/apertium/apertium-apy/blob/master/setup.py#L68. There's probably a different pkg_resources or pkgutil method to get a path to a data file.
Hey, I have come up with an idea. I am finding langNames.db in root now. Will that be fine?
No, this is a bad idea for a number of reasons including that we shouldn't be searching around the user's filesystem (let's be privacy-sensitive).
Did neither pkg_resources not pkgutil have anything useful? I'm relatively certain they will.
I have been trying to find out if any of the function in both the packages can help. Both rely on installed modules, which in our case is apertium_apy
Either we do path manipulation as in my previous PR ( the hardcoded one) becuase when we search apertium_modules it takes us to installed package. Well I will keep on searching.
Starting fresh pull request that solves issue 107