lilypond-user
[Top][All Lists]
Advanced

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

Re: implicitly running a lilypond script through a python script before


From: Joseph Chrestien
Subject: Re: implicitly running a lilypond script through a python script before compilation
Date: Sun, 1 May 2016 23:04:05 +0000

> Yes, see this thread in the german forum
> http://www.lilypondforum.de/index.php?topic=2087.0
discussed are different possibilities:

> (1) python from within a lilyfile.ly:

Yay, it works! I have "Hello world" in the log, which is already great.

However, I can't find yet whether I have some chance of recursively modifying 
the Lilypond input through python before compilation goes any further... the 
German forum conversation does not mention that and I suspect it will not be 
very easy... However, I should be able to read from it and (over)write an 
external lilyfile, then have that one included in the original score. Looking 
good to me.

I'll keep you updated with that. Thanks for the tip (I'm desperate with Guile 
:S)
Joseph

PS
> (2) use make
> (3) use abjad
As I'm working with others (some of them the non geek type), the lesser the 
better, but thks anyway.

---------------------------------------------------------------------------------------
From: Thomas Morley <address@hidden>
Sent: Sunday, May 1, 2016 6:21 PM
To: Joseph Chrestien
Cc: address@hidden
Subject: Re: implicitly running a lilypond script through a python script 
before compilation

2016-05-01 22:48 GMT+02:00 Joseph Chrestien <address@hidden>:
> Hi all,
>
> I know this is going to sound strange: is it possible (or even imaginable) to 
> run a Python code snippet from "within" Lilypond code at compile time?


Yes, see this thread in the german forum
http://www.lilypondforum.de/index.php?topic=2087.0
discussed are different possibilities:

(1) python from within a lilyfile.ly:

Example:

The file hello-world.py contains:

print "Hello World!"

In a .ly-file:

pyMx =
#(define-void-function (parser location)()
    (system "python hello-world.py")
    ;; or:
    ;(system* "python" "hello-world.py")
  )

\pyMx

(2) use make
(3) use abjad
Example here:
http://abjad.mbrsi.org/for_beginners/abjad_hello_world_in_a_file.html


HTH,
  Harm



reply via email to

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