danhper / python-i18n

Easy to use i18n library for Python
https://pypi.python.org/pypi/python-i18n
MIT License
228 stars 45 forks source link

doesn't work with AWS lambdas #16

Closed amdmax closed 4 years ago

amdmax commented 4 years ago

my configuration


import i18n from i18n import t

FILE_PATH = './translations/'

i18n.set('locale', 'ru') i18n.set('fallback', 'en') i18n.set('skip_locale_root_data', True) i18n.load_path.append(FILE_PATH)

print('i18 configuration loaded') print(i18n.load_path)


the output of the following stuff running in process

from os import listdir from os.path import isfile, join files = [f for f in listdir(FILE_PATH) if isfile(join(FILE_PATH, f))]

print(files))


['bot.en.yml', 'bot.ru.yml']


bot: hi: Well, hello

When running within a test with pytest - it works just fine. In an AWS lambda it does't

amdmax commented 4 years ago

Ok. so so far I found out that import("yaml") in config.py failed to load yaml. I use serverless framework with serverless-python-requirements plugin. And it didn't load yaml in aws lambda environment. eventually resolved the issue with adding pyyaml into requirements.txt file. Suppose the issue can be closed now. However, having more logs could be beneficial.