lily > On Jan 29, 2021, at 12:37 PM, Jean Abou Samra <j...@abou-samra.fr> wrote: > >> I got a .ly file claiming to be version 2.18.0 and opened it in LP version >> 2.22.0-1. When I did “Update syntax” I got these errors, and the version in >> the file did not change. >> >> >> [Image showing AttributeError: 'file' object has no attribute 'detach' >> I can typeset the file with no problems. >> >> >> I thought you should know. > > > Hello, > > This is a serious problem. The error indicates that > Python 2 is being used. The scripts were ported to > Python 3 in release 2.22. What is your OS? How are > you running convert-ly? Does it reproduce in a terminal? > (Try running 'convert-ly myfile.ly' there.) > > Eventually this should be made a bug report to the > bug-lilypond list (see lilypond.org/contact.html).
MacBook Pro Mavericks. I picked "Update Syntax" from the Lilypond Compile menu. I added a line of code in the offending file asking it to print the Python version. It’s 2.6.6 and was created by Apple. Just now I ran this: /Applications/LilyPond.app/Contents/Resources/bin/convert-ly chloris.ly and redirected the output into a file. Worked like a champ, and changed the version in the file to 2.22. Opened that file in lily pond and compiled it; also worked like a champ. So I tried putting the python3 shebang line at the beginning of convert-ly.py but discovered that it’s already there. Then I tried putting it in the file lilylib.py that actually threw the error. It wasn’t already there, but adding it did not fix anything. Somehow the decision to use the Apple 2.6.6 has been made before it starts to read convert-ly.py, and nothing is going to change its mind about that. I’ll go send this to the bug list right now. As a slightly related aside, can somebody point me to an explanation of the line of code that is cited in the error message? sys.stdin = codecs.getreader('utf8')(sys.stdin.detach()) My Python skills don’t reach far far enough to grok that syntax. thanks