lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lilypond source code indenter and formatter


From: Federico Bruni
Subject: Re: Lilypond source code indenter and formatter
Date: Thu, 07 Jun 2012 07:09:26 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.4) Gecko/20120510 Icedove/10.0.4

Il 07/06/2012 02:49, Colin Hall ha scritto:
It seems to be equipped to run as a program:

lgc$ wgethttp://lilykde.googlecode.com/svn/trunk/frescobaldi/python/ly/indent.py
lgc$

I'd rather use the version in the current repository:
wget https://raw.github.com/wbsoft/frescobaldi/master/frescobaldi_app/indent.py

Actually you'd better download all the source, as indent.py depends on some internal modules:

import ly.lex
import ly.lex.scheme
import cursortools
import tokeniter
import variables

lgc$ python -V
Python 2.6.5
lgc$
lgc$ python indent.py -t 2 Heidenroeslein.ly
Traceback (most recent call last):
   File "indent.py", line 252, in<module>
     startscheme=options.scheme
   File "indent.py", line 107, in indent
     usetabs = '\t' in space or '\n\t' in text
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 48: 
ordinal not in range(128)
lgc$

I don't have experience with python Unicode support. Is 2.6.5 new enough for 
this to work?

I get the same in Python 2.7.3.

I think that the error is explained here:
http://docs.python.org/release/3.0.1/whatsnew/3.0.html#text-vs-data-instead-of-unicode-vs-8-bit

As a quick solution, you can try to update indent.py to python3:
2to3 indent.py

then use:
python3 indent.py -t 2 file.ly

The error goes away... but I'm not sure that the script actually works this way: I've tried to set -t 4 (all my ly files have 2 space indentation), but nothing changes.

PS I'm not a coder :-)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]