Back on January 12, 2021, I wrote to this forum about a problem I was
having running the example from
https://lilypond.org/doc/v2.19/Documentation/usage/an-example-of-a-musicological-document
for embedding Lilypond code inside a LaTeX document.  The python script,
lilypond-book.py starts up, I get a few lines of output, and then the
program hangs.  One reader of this forum wrote to me that the script works
for him, so I knew there was something about my installation of Lilypond or
version of Python or something.  By the way, I had no problems with
lilypond-book on Linux.

Today I began to read through the python code that runs when
lilypond-book.py is invoked.  The authors of the python code cleverly, in
python-latex.py, create a temporary .tex file that is run with pdflatex to
extract some information about the linewidth and column separation.  The
authors import the python library tempfile and use the method mkstemp to
create the filename for the temporary file.  I sprinkled some print
functions into the python code to trace what was going on and discovered
that the temporary file gets created on my Windows 10 system in:
C:\Users\<user_id>\AppData\Local\Temp
where <user_id> is my Windows user account name.  My user_id has 9
characters in it, for example DanABCDEF.  However, the path for the
temporary file was shown by one of my debugging print statements to be
C:\Users\DanABCD~F\AppData\Local\Temp.  This is an old DOS "8.3" file
naming convention DOS used to deal with "long"  path and filenames.

After creating this temporary file, pdflatex tries to run on it and
pdflatex gags because it can't find the file;  pdflatex can't deal with the
"~" in the file pathname.  The process that is running pdflatex tries to
prompt me to enter another name.  However that process' output isn't shown
and all I see is a hung program.

So because my user_id is more than 8 characters long the temporary file
pathname gets trashed.  I bet the user who wrote me that lilypond-book
worked for him has a short Windows user_id!

I've looked around a little bit in Python to see if there are options when
the mkstemp is called to create a Windows temporary filename without the
"8.3" legacy DOS naming convention.  I didn't see anything.  Some of my
Google searches suggested there is an additional library that could be
imported that deals with long filenames.

I am turning this over to any follower of this forum who is more skilled
than I am in Python to come up with a fix.

By the way, I am using Lilypond and lilypond-book to engrave a short piece
of music into a lab assignment handout sheet that I create in LaTeX that I
give to my digital signal processing (DSP) students.  They have to
synthesize the music on a DSP hardware board.

Thank you for your help.

Dan

Reply via email to