Failure of convert-ly to run

Élie Gouzien <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.bugs
Message-ID <CAD40m7sEqPUr+MomBsD1y9KHnWfTMZeA5MuhXnWW4=VLyuzAew@mail.gmail.com>
Hello,

I have a file for which convert-ly crashes. The message is:

convert-ly (GNU LilyPond) 2.24.3

convert-ly: Traitement de « k477-basset-horn.ly »...
Conversion en cours : 2.5.0, 2.5.1, 2.5.2, Traceback (most recent call
last):
  File "/usr/bin/convert-ly", line 445, in <module>
    main()
  File "/usr/bin/convert-ly", line 429, in main
    errors += do_one_file(f)
              ^^^^^^^^^^^^^^
  File "/usr/bin/convert-ly", line 340, in do_one_file
    do_conversion(input, from_version, to_version)
  File "/usr/bin/convert-ly", line 246, in do_conversion
    newstr = x[1](s)
             ^^^^^^^
  File "/usr/share/lilypond/2.24.3/python/convertrules.py", line 2154, in
conv
    s = re.sub(r'\\markup\s*{([^}]|{[^}]*})*}', get_markup, s)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 185, in sub
    return _compile(pattern, flags).sub(repl, string, count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/share/lilypond/2.24.3/python/convertrules.py", line 2152, in
get_markup
    s = re.sub(r'''((\\"|})\s*){''', '\2 \\line {', s)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 185, in sub
    return _compile(pattern, flags).sub(repl, string, count)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 317, in _subx
    template = _compile_repl(template, pattern)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/__init__.py", line 308, in _compile_repl
    return _parser.parse_template(repl, pattern)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/re/_parser.py", line 1087, in parse_template
    raise s.error('bad escape %s' % this, len(this)) from None
re.error: bad escape \l at position 2

----------------------------------------------------------------------------------

It seems to be fixed by changing line 2152 of convertrules.py by putting
the second argument as a raw string:
s = re.sub(r'''((\\"|})\s*){''', r'\2 \\line {', s)

Thanks for the amazing work on Lilypond!
Élie
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.