On Tue, Feb 17, 2009 at 11:01 AM, Wayne Watson <sierra_mtnv...@sbcglobal.net
> wrote:

>  Here's the print from the code line below.
>
> Second line from the top.
>

There it is - stop_time is a str at this point in the program, so has no
strftime attribute or method.  Step back through your code and see why...  I
find Control-F very helpful in situations like this!


>
> Regarding, ConfigObj, I was aware of it when I decided to go this route.
> That's the one that uses has an init file like Windows?  Rather than have to
> go through a learning process on it (the Win init module/object), and some
> uncertainty about it's acceptability in my situation, I thought I'd be more
> exploratory and proceed as I have. So far it has paid off in many learning
> dividends. ConfigObj, if not the Win stuff, may be attractive. Anyway, I'd
> like to proceed for the moment with this effort.
>

There's nothing sacred about the ".ini" extension - any text file that
contains "variable = value" pairs is game.  ConfigObj is not
Windows-centric.  The advantage - which is what I was trying to show when I
posted that gosh-awful hunk of code - is that you can define the format of
the file in one central section of your program - it could even be a
separate module if you wanted - and in one swell foop you tell ConfigObj the
name of the variable, its type, acceptable values or range, and a default
value in case it's missing.  Opening, reading, closing, writing, validating
- all handled.

I certainly wouldn't want to dissuade you from writing your own as a
learning exercise - I'm glad I did - but each time I need to update one of
my old programs that still uses my homegrown ConfigFile, that's the first
thing I re-factor.

-- 
www.fsrtechnologies.com

<<image/jpeg>>

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to