Le lundi 02 juillet 2007 à 21:58 -0300, Han-Wen Nienhuys a écrit :
> 2007/7/2, John Mandereau <[EMAIL PROTECTED]>:
> 
> > To fix this, we must use ugettext instead of gettext in lilylib.py.
> > Unfortunately, this fix implies that each gettexted string must be
> > converted from Python internal Unicode to stdout/stderr encoding before
> > being written to stdout/stderr.
> >
> > May I commit and push the following patch, that intends to solve all
> > problems above?
> 
> I'm not aware of all the issues, but I believe your story. However,
> would it be better to define a encoded_write or similar, ie.
> 
>   def encoded_write(f, s):
>     f.write (s.encode (f.encoding))
> 
> and perhaps
> 
>   def log(s):
>     encoded_write(sys.stderr, s)

You're right, it avoids code duplication.

There is something I don't catch in this story: print does the
encoded_write conversion defnined above automatically.  Why would we
have to add a layer to the file.write method, whereas file.write could
do the conversion itself, since it can read the file.encoding property?
I feel a bit like this is a bug/limitation in Python 2.5 file.write()
implementation.

As I have no urgent need using lilypond-book from Git HEAD (I only
wanted to see 'lilypond-book --help' output when looking at updating
lilypond-book docs), I'll submit a patch/report the bug to Python
hackers when I'm back.

Greetings
John



_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to