Skip to content

TypeError while executing 'pybabel update ...' in Python 3.x #91

@williamwu0220

Description

@williamwu0220

I installed babel in Python 3.4.0 env, and babel cannot work while using update sub-command as follows:

william$ pybabel update -i i18n/locale/message.pot  -l zh_TW -d i18n/locale/ -D i18n
updating catalog 'i18n/locale/zh_TW/LC_MESSAGES/i18n.po' based on 'i18n/locale/message.pot'
Traceback (most recent call last):
  File "/Users/william/venv/pyramid/bin/pybabel", line 9, in <module>
    load_entry_point('Babel==1.3', 'console_scripts', 'pybabel')()
  File "/Users/william/venv/pyramid/lib/python3.4/site-packages/babel/messages/frontend.py", line 1151, in main
    return CommandLineInterface().run(sys.argv)
  File "/Users/william/venv/pyramid/lib/python3.4/site-packages/babel/messages/frontend.py", line 665, in run
    return getattr(self, cmdname)(args[1:])
  File "/Users/william/venv/pyramid/lib/python3.4/site-packages/babel/messages/frontend.py", line 1130, in update
    width=options.width)
  File "/Users/william/venv/pyramid/lib/python3.4/site-packages/babel/messages/pofile.py", line 444, in write_po
    _write(comment_header + u'\n')
  File "/Users/william/venv/pyramid/lib/python3.4/site-packages/babel/messages/pofile.py", line 388, in _write
    fileobj.write(text)
TypeError: must be str, not bytes

My env:
python: 3.4.0
os: Debian Wheezy
Babel: 1.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions