Skip to content

unorderable types in write_po #606

Closed
@mfrasca

Description

@mfrasca

I'm using babel-2.6.0, and I'm hitting a problem with generated data, not something I can fix on that end.

I have a standard Makefile for generating pot files, then I use msgcat to produce a single merged pot, which I then update with the line:

sphinx-intl update -p _build/locale-merged $(for i in $LANGUAGES; do printf -- '-l %s ' $i; done)

and the result is a crash:

babel/messages/pofile.py", line 552, in write_po
    for filename, lineno in sorted(message.locations):
TypeError: unorderable types: NoneType() < int()

which I fixed very brutally by adding a key parameter to the sorted function:

sorted(message.locations, key=(lambda x: (x[0], x[1] or -1)))

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions