OpenPecha / Botok

🏷 བོད་ཏོག [pʰøtɔk̚] Tibetan word tokenizer in Python
https://botok.readthedocs.io/
Apache License 2.0
58 stars 15 forks source link

Path issue after frozen with PyInstaller on macOS #59

Closed BLKSerene closed 5 years ago

BLKSerene commented 5 years ago

Hi, the path in the following file is resolved to something like Users/username/Desktop/program.app/Contents/MacOS/pybo/textunits/../resources/bo_uni_table.csv instead of Users/username/Desktop/program.app/Contents/MacOS/pybo/resources/bo_uni_table.csv after pybo is frozen into my program using PyInstaller on macOS, crashing the program on startup

https://github.com/Esukhia/pybo/blob/81bfeb19311d1dd44f9bbb31d891155353377b07/pybo/textunits/charcategories.py#L9

This issue occurs on LInux as well (tested on Ubuntu 16.04), but does not happen on Windows.

I solved this issue by modifying this line before freezing pybo into my program: table_path = Path(__file__).parent.parent / "resources/bo_uni_table.csv"

So is it okay for pybo to modify its codebase to help freezing on macOS and Linux?

drupchen commented 5 years ago

Sure! I'll do that right now. Thanks for the suggestion that makes code clearer.

drupchen commented 5 years ago

solved in 5ec9b32fa6624ac2ecb96035cf9f5c7248e43507, release 0.6.8. You can directly download it from pypi

BLKSerene commented 5 years ago

Thanks!