Guile Error on Lilypond 2.24.1

Description:

I’m encountering engraving errors on Mac Ventura 13.3.1 (Intel) w/ abjad 3.4 and lilypond 2.24.1

It seems that lilypond is only distributing tarballs rather than .dmg apps now. However, I installed lilypond via brew (along with frescobaldi, the recommended GUI). Those function fine on their own. All other deps have been installed into a venv within an asdf install of python@3.10.10

Taking a complete shot in the dark, the guile scheme parsing in lilypond@2.24.1 seems to have been updated to guile 3 and the resulting .ly files are malformed.

Error printout:

(scamp) ➜  ~/code/music/1 ~/code/envs/scamp/bin/python ~/code/music/1/broken.py
Using preset Sitar for sitar
Using preset Taiko Drum for taiko
GNU LilyPond 2.24.1 (running Guile 3.0)
Changing working directory to: `/var/folders/2j/hy5svl591jjg_55t9837xyl80000gn/T/tmp6byp_sr0'
Processing `/var/folders/2j/hy5svl591jjg_55t9837xyl80000gn/T/tmp6byp_sr0/2023-04-30T23-36-29-965729-a72f74c.ly'
Parsing...
/Users/<redacted>/Library/Application Support/SCAMP/scamp_lilypond_template.ly:25:25: warning: deprecated: missing `.' in property path Glissando.breakable
    \override Glissando 
                        #'breakable = ##t
Interpreting music...[8]
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Converting to `2023-04-30T23-36-29-965729-a72f74c.pdf'...
warning: `(gs -q -dNODISPLAY -dNOSAFER -dNOPAUSE -dBATCH -dAutoRotatePages=/None -dPrinted=false /var/folders/2j/hy5svl591jjg_55t9837xyl80000gn/T//lilypond-tmp-7482803)' failed (11)

/usr/local/Cellar/lilypond/2.24.1/share/lilypond/2.24.1/ly/init.ly:65:2: error: Guile signaled an error for the expression beginning here
#
 (let ((book-handler (if (defined? 'default-toplevel-book-handler)
Throw to key `ly-file-failed' with args `()'.

The full code that resulted in the error:

from itertools import cycle, repeat

from scamp import *

s = Session()
s.tempo = 120
measures = 2

sitar = s.new_part("sitar")
taiko = s.new_part("taiko")

sitar_pitch_list = cycle([50, 51, 54])
sitar_duration_list = repeat(0.5, 12 * measures)

taiko_pitch_list = cycle([50, 54, 57, None])
taiko_volume_list = cycle([0.5, 0.6, 0.75, 0.9, 0.5, 0.7, 0.8])
taiko_duration_list = [0.25, 0.25, 0.5] * 12

def sitar_part():
    for pitch, duration in zip(sitar_pitch_list, sitar_duration_list):
        sitar.play_note(pitch, 0.5, duration) 

def taiko_part():
    for pitch, volume, duration in zip(taiko_pitch_list, taiko_volume_list, taiko_duration_list):
        taiko.play_note(pitch, volume, duration)

s.start_transcribing()
s.fork(sitar_part)
s.fork(taiko_part)
s.wait_for_children_to_finish()
performance = s.stop_transcribing()
performance.to_score(time_signature="3/8").show()

I’m getting exactly the same error. I just updated to scamp 0.9.2, the latest versions of abjad and lilypond. I’m running on Mac Silicon using VS Code.

@MarcEvanstein , any ideas that can solve this? Thanks! :smiley_cat:

So this error is really frustrating, because I remember encountering it once, doing something to fix it, and then forgetting what I did. The error it’s signaling acts like it’s part of the lilypond init file, which isn’t part of scamp or even abjad. So I’m not sure what the deal is; maybe you start by checking if abjad works on its own:

import abjad
abjad.show(abjad.Note("c'"))

Does this throw an error?

Oh, another thing you could try:

Take the script where you’re getting that error, and then, instead of writing:

score.show()

Do:

score.print_lilypond()

What does it print? We could try putting the lilypond directly into something like frescobaldi and seeing if it compiles.

This seems like a lilypond error; I encountered this running lilypond directly completely outside of scamp. I think it has to do with an incompatibility with Ghostscript, which is meaning that when lilypond calls gs to do ps2pdf (I’m pretty sure that’s what they use) it throws an error. I’ve had results from running lilypond specifically so that it outputs a PostScript file, and then manually converting it to a pdf. I have no clue how to fix this error though.