jh0ker/mau_mau_bot

internationalization.py line 38

Sh1vam opened this issue · 10 comments

it gives error of this type:

\mau_mau_bot-master\internationalization.py", line 38, in
open(gettext.find(
TypeError: expected str, bytes or os.PathLike object, not NoneType

the code is:
def init(self):
self.translators = {
locale: gettext.GNUTranslations(
open(gettext.find(
GETTEXT_DOMAIN, GETTEXT_DIR, languages=[locale]
), 'rb')
)
for locale
in available_locales.keys()
if locale != 'en_US' # No translation file for en_US
}
self.locale_stack = list()

DO97 commented

More specifically, when this happens?

More specifically, when this happens?

when i was trying to run it on my PC

same issue here

python3 bot.py
Traceback (most recent call last):
  File "bot.py", line 30, in <module>
    import settings
  File "/home/pi/unoplusbot/mau_mau_bot/settings.py", line 24, in <module>
    from utils import send_async
  File "/home/pi/unoplusbot/mau_mau_bot/utils.py", line 25, in <module>
    from internationalization import _, __
  File "/home/pi/unoplusbot/mau_mau_bot/internationalization.py", line 81, in <module>
    _ = _Underscore()
  File "/home/pi/unoplusbot/mau_mau_bot/internationalization.py", line 43, in __init__
    in available_locales.keys()
  File "/home/pi/unoplusbot/mau_mau_bot/internationalization.py", line 44, in <dictcomp>
    if locale != 'en_US'  # No translation file for en_US
TypeError: expected str, bytes or os.PathLike object, not NoneType

did you follow the instructions in the readme, specifically about compiling the translation files?

did you follow the instructions in the readme, specifically about compiling the translation files?

Yes

This error usually happens if you're missing a .mo file for one or more of your translations. Confirm that you have a .mo file for every .po file, eg. locales/de_DE/LC_MESSAGES/unobot.mo. If you added custom translations, they have to be added in the locales/compile.sh script.

I suggest you ensure you're not missing any commits from this repos master branch and re-compile all translations, eg.

cd locales
./compile.sh

compile.sh didn't work for me, made it with the full command... problem fixed! Wasn't executing the command inside the locales folder.

Same issue in compiling

It didn't work the compile.sh

DO97 commented

I'm not having any issue following the instructions.