Coder Social home page Coder Social logo

Comments (6)

izimobil avatar izimobil commented on July 17, 2024

Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):


I still do not reproduce this issue, all entries starting with "#." are correctly parsed.
That said, "#~|" fails, but this is another issue reported here: #28/ioerror-on-reading-obsolete-previous-msgid

Please (@og Maciel, @rachidbm) if you still reproduce the issue with "#." try to post a reproducible case with a description of your environment (os, python version, etc.).
Thanks a lot !

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by rachidbm (Bitbucket: rachidbm, GitHub: rachidbm):


I got the same error again when the .po file contains comment like: #~|
It works when I changed a statement to:

elif (tokens[0] == '#.' or tokens[0] == '#~|')  and nb_tokens >= 1:

Don't know if this will break something else, but for me polib is usable again :)

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by rachidbm (Bitbucket: rachidbm, GitHub: rachidbm):


I think I have almost the same problem in polib 0.7. When the .po file contains the line "#." parse() terminates with the error:

#!bash
  File "/usr/lib/python2.7/dist-packages/polib.py", line 102, in pofile
    return _pofile_or_mofile(pofile, 'pofile', **kwargs)
  File "/usr/lib/python2.7/dist-packages/polib.py", line 73, in _pofile_or_mofile
    instance = parser.parse()
  File "/usr/lib/python2.7/dist-packages/polib.py", line 1250, in parse
    self.process('??', i)
  File "/usr/lib/python2.7/dist-packages/polib.py", line 1313, in process
    raise IOError('Syntax error in po file (line %s)' % linenum)
IOError: Syntax error in po file (line 4202)

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by Og Maciel (Bitbucket: omaciel, GitHub: omaciel):


If filename is http://l10n.gnome.org/POT/gnome-terminal.master/gnome-terminal.master.zh_TW.po which is saved locally, then:

In [13]: po = pofile(filename, autodetect_encoding=True, encoding='utf-8')
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (607, 0))

IOError Traceback (most recent call last)
/Library/Python/2.7/site-packages/django/core/management/commands/shell.pyc in ()
----> 1 po = pofile(filename, autodetect_encoding=True, encoding='utf-8')

/Library/Python/2.7/site-packages/polib.pyc in pofile(pofile, **kwargs)
100 file (optional, default: False).
101 """
--> 102 return _pofile_or_mofile(pofile, 'pofile', **kwargs)
103
104 # `

/Library/Python/2.7/site-packages/polib.pyc in _pofile_or_mofile(f, type, **kwargs)
71 check_for_duplicates=kwargs.get('check_for_duplicates', False)
72 )
---> 73 instance = parser.parse()
74 instance.wrapwidth = kwargs.get('wrapwidth', 78)
75 return instance

/Library/Python/2.7/site-packages/polib.pyc in parse(self)
1248
1249 else:
-> 1250 self.process('??', i)
1251
1252 if self.current_entry:

/Library/Python/2.7/site-packages/polib.pyc in process(self, symbol, linenum)
1311 self.current_state = state
1312 except Exception:
-> 1313 raise IOError('Syntax error in po file (line %s)' % linenum)
1314
1315 # state handlers

IOError: Syntax error in po file (line 2143)

In [17]: polib.version
Out[17]: '0.7.0'

The contents for line 2143 show:

#. Translators: This is the label of a menu item to choose a profile.
#. * %c is used as the accelerator (it will be a character between A and Z),
#. * and the %s is the name of the terminal profile.
#.
#: ../src/terminal-window.c:483
#, c-format
msgid "
%c. %s"
msgstr "_%c. %s"

from polib.

izimobil avatar izimobil commented on July 17, 2024

Original comment by David Jean Louis (Bitbucket: izi, GitHub: izi):


I can't reproduce the error with the given sample data...

Please be more explicit, what is the error message ? which version of polib are you running ? etc.

from polib.

izimobil avatar izimobil commented on July 17, 2024

Close this historic issue

from polib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.