[Top][All Lists]

[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:
> >
> >scripts/build/ 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.

> >
> >scripts/build/ 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.

> >
> >scripts/build/ 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?

- Graham

reply via email to

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