Eric Fahlgren <ericfahlg...@gmail.com> added the comment:

After a bit more digging, it's a side effect of having the locale set with 
'Plural-Forms'.  I've attached the resulting .mo file, but since it's a binary, 
I'm not sure it will work cross-platform, so here's how to recreate it.

> cat en_US/LC_MESSAGES/foo.po
msgid ""
msgstr "Plural-Forms: nplurals=2; plural=(n != 1);\n"

> python /Python37/Tools/i18n/msgfmt.py en_US/LC_MESSAGES/foo.po
> ll en_US/LC_MESSAGES/
-rwx------+ 1 efahlgren Domain Users 89 2019-01-19 14:36 foo.mo*
-rw-r--r--+ 1 efahlgren Domain Users 69 2019-01-19 14:34 foo.po

Then you can reproduce with some setup in your script:

import os
import gettext
import argparse

os.putenv('LANG', 'en_US')  # Just to make sure.
gettext.bindtextdomain('foo', '.')
gettext.textdomain('foo')

p = argparse.ArgumentParser()
p.add_argument('--foo', nargs=None)
p.parse_args()

----------
Added file: https://bugs.python.org/file48068/foo.mo

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35785>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to