wichert / lingua

Translation toolkit for Python
Other
46 stars 32 forks source link

Skipping linenumbers yields TypeError #90

Closed jenner closed 6 years ago

jenner commented 6 years ago

lingua 4.9 python 3.4.3

Create a file foo.py:

_ = lambda a: a

FOOS = (
   _('one'),
   _('two')
)

Run pot-create:

$ pot-create -o bla.pot --keyword "_" foo.py --no-linenumbers once:

a bla.pot is created correctly and contains 'one' and 'two' msgids. Now run pot-create again:

$ pot-create -o bla.pot --keyword "_" foo.py --no-linenumbers
Traceback (most recent call last):
  File "/opt/venv/bin/pot-create", line 9, in <module>
    load_entry_point('lingua==4.9', 'console_scripts', 'pot-create')()
  File "/opt/venv/lib/python3.4/site-packages/lingua/extract.py", line 356, in main
    save_catalog(catalog, options.output)
  File "/opt/venv/lib/python3.4/site-packages/lingua/extract.py", line 230, in save_catalog
    if old_catalog is not None and identical(catalog, old_catalog):
  File "/opt/venv/lib/python3.4/site-packages/lingua/extract.py", line 220, in identical
    return a == b
  File "/opt/venv/lib/python3.4/site-packages/lingua/extract.py", line 64, in __eq__
    r = super(POEntry, self).__eq__(other)
  File "/opt/venv/lib/python3.4/site-packages/polib.py", line 1083, in __eq__
    return self.__cmp__(other) == 0
  File "/opt/venv/lib/python3.4/site-packages/polib.py", line 1048, in __cmp__
    if entry1[1] > entry2[1]:
TypeError: unorderable types: NoneType() > str()

Without --no-linenumbers option pot-create works as expected.

jenner commented 6 years ago

Just checked - the behavior was introduced in 4.9, 4.8.1 works fine...

jenner commented 6 years ago

Sorry, my bad, it was fixed in 4.10 :)