[Archetypes-users] i18ndude making a UnicodeDecodeError

7 views
Skip to first unread message

Jean-Sébastien Mansart

unread,
Mar 4, 2011, 3:24:19 AM3/4/11
to archetyp...@lists.sourceforge.net
Hi,

I'm working with argouml and archgenxml to generate my product.
When I'm trying to rebuilt the pot file like this :
I18NDOMAIN="BSWConcoursPhoto"
/root/i18ndude-3.2.2/bin/i18ndude rebuild-pot --pot i18n/generated.pot \
    --create ${I18NDOMAIN} \
    --merge locales/${I18NDOMAIN}.pot \
   .

I've got this error :
Traceback (most recent call last):
  File "/root/i18ndude-3.2.2/bin/i18ndude", line 32, in <module>
    i18ndude.script.main()
  File "/root/i18ndude-3.2.2/src/i18ndude/script.py", line 473, in main
    fun()
  File "/root/i18ndude-3.2.2/src/i18ndude/script.py", line 214, in rebuild_pot
    pyresult = pyreader.read()
  File "/root/i18ndude-3.2.2/src/i18ndude/catalog.py", line 676, in read
    exclude=self.exclude+('tests', ))
  File "/root/i18ndude-3.2.2/src/i18ndude/extract.py", line 445, in py_strings
    tokenize.tokenize(fp.readline, eater)
  File "/zope/z_nature_images_awards/Python-2.6/lib/python2.6/tokenize.py", line 169, in tokenize
    tokenize_loop(readline, tokeneater)
  File "/zope/z_nature_images_awards/Python-2.6/lib/python2.6/tokenize.py", line 175, in tokenize_loop
    for token_info in generate_tokens(readline):
  File "/zope/z_nature_images_awards/Python-2.6/lib/python2.6/tokenize.py", line 288, in generate_tokens
    line = readline()
  File "/zope/z_nature_images_awards/Python-2.6/lib/python2.6/codecs.py", line 675, in readline
    return self.reader.readline(size)
  File "/zope/z_nature_images_awards/Python-2.6/lib/python2.6/codecs.py", line 530, in readline
    data = self.read(readsize, firstline=True)
  File "/zope/z_nature_images_awards/Python-2.6/lib/python2.6/codecs.py", line 477, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xb0 in position 37: invalid start byte


Thanks for helping !
--

Jean-Sébastien Mansart - Développeur Web
Email : jean-sebast...@bayard-service.com
Tel : 04 79 26 28 29

Bayard Service Edition
Savoie Technolac - House Boat
BP308 - 73377 Le Bourget du Lac Cedex
www.bayardserviceweb.com

Vincent Fretin

unread,
Mar 5, 2011, 3:56:55 AM3/5/11
to Jean-Sébastien Mansart, archetyp...@lists.sourceforge.net
Hi,

You got the order wrong:
i18n/generated.pot is generated by archgenxml, you should not rebuilt it, but merge it.

/root/i18ndude-3.2.2/bin/i18ndude rebuild-pot --pot locales/${I18NDOMAIN}.pot \
    --create ${I18NDOMAIN} \
    --merge i18n/generated.pot \
   .

If you still have a UnicodeDecodeError, remove the --merge option so see if the problem come from the i18n/generated.pot
You shouldn't have accents in your field labels and description in your model. They should be written in English.

Vincent Fretin
Ecreall
Site : http://vincentfretin.ecreall.com


------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
Archetypes-users mailing list
Archetyp...@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/archetypes-users


Jean-Sébastien Mansart

unread,
Mar 7, 2011, 6:07:52 AM3/7/11
to Vincent Fretin, archetyp...@lists.sourceforge.net
Hi,

I've found what's happend.

I works under MacOS, and MacOS creates some temporary files "._*.*"
When i18n dude parse all files, it make an error when parsing those files.

So, in extract.py I have made a little change on line 423 in def find_files(dir, pattern, exclude=())::

419     def visit(files, dirname, names):
420         names[:] = filter(lambda x:x not in exclude, names)
421         files += [os.path.join(dirname, name)
422                   for name in fnmatch.filter(names, pattern)
423                   if name not in exclude and '._' not in name]

I don't know how to report it in the project. I will look at it later in the afternoon.

Jean-Sébastien Mansart - Développeur Web
Email : jean-sebast...@bayard-service.com
Tel : 04 79 26 28 29

Bayard Service Edition
Savoie Technolac - House Boat
BP308 - 73377 Le Bourget du Lac Cedex
www.bayardserviceweb.com


Le 05/03/11 09:56, Vincent Fretin a écrit :
Reply all
Reply to author
Forward
0 new messages