lilypond-devel
[Top][All Lists]
Advanced

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

Re: Fix error messages in website build (issue4428077)


From: Graham Percival
Subject: Re: Fix error messages in website build (issue4428077)
Date: Mon, 2 May 2011 18:28:21 +0100
User-agent: Mutt/1.5.20 (2009-06-14)

On Mon, May 02, 2011 at 05:29:27PM +0100, Phil Holmes wrote:
> >http://codereview.appspot.com/4428077/diff/1/scripts/build/extract_texi_filenames.py#newcode65
> >scripts/build/extract_texi_filenames.py:65: known_missing_files = ''
> >could this be a list instead of a string?
> 
> I thought about whether a string was the _best_ solution, but
> decided that using a read() and find() was simplest and probably
> quickest.

python has .readlines() for a file, and generally it's
"pythonesque" to use lists.

> >http://codereview.appspot.com/4428077/diff/1/scripts/build/extract_texi_filenames.py#newcode87
> >scripts/build/extract_texi_filenames.py:87: known_missing_files_file = a
> >known_missing_files.append(a)
> 
> Again, I'm assuming that this is changing from a simple string for
> the filename to a list?

Yes.  wait... no -- we're still use a string for the filename, but
using a list of strings for the names of files.


um, let me get back to you on this.  I've just confused myself.

>  Strikes me we don't want lots of lists of
> missing files we can pass to the script - that'll just get confusing
> - I'd suggest just using a single file for any call.

It's not like that -- we still pass in a single filename.  But the
contents of that file are then read into a list variable, rather
than leaving them in a string variable.

> >http://codereview.appspot.com/4428077/diff/1/scripts/build/extract_texi_filenames.py#newcode94
> >scripts/build/extract_texi_filenames.py:94: missing_files = open
> >(known_missing_files_file, 'r')
> >missing_Files = open(...).readlines()
> >
> >then you don't need the next two lines.
> 
> So with:
> 
> string = open("filename").read()
> 
> You don't need the close() ?

That is not correct.  With .readlines(), you don't need the
close().  (at least, that's what I was told, but I don't see it in
the docs.  hmm, maybe I should change all my files!)

oh wait, maybe it was a special case where you don't assign the
file to a variable?

Cheers,
- Graham



reply via email to

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