[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Errors running lilypond-book
From: |
Daniel Rosen |
Subject: |
RE: Errors running lilypond-book |
Date: |
Fri, 10 Jan 2014 15:24:23 +0000 |
> -----Original Message-----
> From: David Kastrup [mailto:address@hidden
> Sent: Thursday, January 09, 2014 2:11 PM
> To: Daniel Rosen
> Cc: address@hidden
> Subject: Re: Errors running lilypond-book
>
> Daniel Rosen <address@hidden> writes:
>
> > I'm trying to follow the tutorial at
> http://www.lilypond.org/doc/v2.18/Documentation/usage/an-example-of-
> a-musicological-document; I run Windows 7 x86. When I run the command it
> tells me to (lilypond-book --output=out --pdf lilybook.lytex), here's what I
> get (I've redacted my username from the temp file path):
> >
> > lilypond-book.py (GNU LilyPond) 2.18.0 Reading lilybook.lytex...
> > Running `pdflatex' on file
> > `c:\users\...\appdata\local\temp\tmpfvqw3p.tex' to detect default page
> settings.
> >
> > 'TEXINPUTS' is not recognized as an internal or external command,
> > operable program or batch file.
> > lilypond-book.py: warning: Unable to auto-detect default settings:
> >
> > lilypond-book.py: warning: cannot detect textwidth from LaTeX
> > Dissecting...
> > lilypond-book.py: error: file not found: screech-and-boink.ly
> >
> > Traceback (most recent call last):
> > File "C:\Program Files\LilyPond\usr\bin\lilypond-book.py", line 776, in ?
> > main ()
> > File "C:\Program Files\LilyPond\usr\bin\lilypond-book.py", line 759, in
> main
> > chunks = do_file (files[0])
> > File "C:\Program Files\LilyPond\usr\bin\lilypond-book.py", line 611,
> > in do_fil e
> > chunks = find_toplevel_snippets (source, global_options.formatter)
> > File "C:\Program Files\LilyPond\usr\bin\lilypond-book.py", line 362,
> > in find_t oplevel_snippets
> > snip = klass (type, m, formatter, line_number, global_options)
> > File "out/book_snippets.py", line 815, in __init__
> > File "out/book_base.py", line 27, in find_file
> > TypeError: 'str' object is not callable
> >
> > How do I get this to work?
>
> That would seem to be
> commit aefc5a4057a0a61f1d7e4411cc1c5061d9aea6b7
> Author: Julien Rioux <address@hidden>
> Date: Wed Jan 23 18:21:22 2013 -0500
>
> lilypond-book: Textwidth detection with included file (issue 3136).
>
> Fix the automatic textwidth detection performed by lilypond-book.
> This failed for lytex files that include an external file in the
> preamble, when such file was compiled in an --output directory
> different from the working directory, because then the included
> file was missing. We use TEXINPUTS to let the latex process know
> where to look for input files.
>
> later "improved" by
> commit 39bf694ef4dedbb350960f7c37955c8fe9ce27e3
> Author: David Kastrup <address@hidden>
> Date: Sat Jul 27 16:44:54 2013 +0200
>
> Issue 3467: lilypond-book 2.17.21 and spaces in file path
>
>
> Versions 2.17.17 and 2.17.24, respectively. Instead one probably needs to
> manipulate the environment directly. No idea how sticky that is.
>
> Actually, it would appear that working with subprocess.Popen would be
> called for here. The respective coode seems to be:
> progress (_ ("Running `%s' on file `%s' to detect default page
> settings.\n")
> % (global_options.latex_program, tmpfile))
> cmd = 'TEXINPUTS="%s:$TEXINPUTS" %s %s' \
> % (global_options.input_dir, global_options.latex_program, tmpfile)
> debug ("Executing: %s\n" % cmd)
> run_env = os.environ.copy()
> run_env['LC_ALL'] = 'C'
>
> ### unknown why this is necessary
> universal_newlines = True
> if sys.platform == 'mingw32':
> universal_newlines = False
> ### use os.system to avoid weird sleep() problems on
> ### GUB's python 2.4.2 on mingw
> # make file to write to
> output_dir = tempfile.mkdtemp()
> output_filename = os.path.join(output_dir, 'output.txt')
> # call command
> cmd += " > %s" % output_filename
> returncode = os.system(cmd)
> parameter_string = open(output_filename).read()
> if returncode != 0:
> warning (_ ("Unable to auto-detect default settings:\n"))
> # clean up
> os.remove(output_filename)
> os.rmdir(output_dir)
> else:
> proc = subprocess.Popen (cmd,
> env=run_env,
> universal_newlines=universal_newlines,
> shell=True,
> stdout=subprocess.PIPE, stderr=subprocess.PIPE)
> (parameter_string, error_string) = proc.communicate ()
> if proc.returncode != 0:
> warning (_ ("Unable to auto-detect default settings:\n%s")
> % error_string)
>
> And normally one should be able to do the TEXINPUTS manipulation just like
> done with LC_ALL. However, that would require looking at what goes wrong
> with mingw32 here. I have no idea what the current GUB version of Python
> is.
>
> --
> David Kastrup
I don't know what any of that means. :-P Is there a workaround? I do know how
to define an environment variable, if that's what's necessary.
DR