<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Yes, about public scrutiny of code and your paragraphs on
"Everything.." and "However, not all..."-- both understood. <br>
<br>
Here's the print from the code line below.<br>
<img src="cid:part1.00010504.03050001@sbcglobal.net" alt=""><br>
Second line from the top.<br>
<br>
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. <br>
<br>
Marc Tompkins wrote:
<blockquote
cite="mid:40af687b0902171011k42a779eayc51ebf0f0396eab1@mail.gmail.com"
type="cite">
<div class="gmail_quote">On Tue, Feb 17, 2009 at 4:44 AM, Wayne
Watson <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:sierra_mtnview@sbcglobal.net">sierra_mtnview@sbcglobal.net</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Note
that the diagnostic output in the image shows attributeError: 'str'
object has no attribute 'strftime'.<br>
<br>
Let me see if I clarify what's really going on by including some of the
code.<br>
</blockquote>
<div><br>
Everything in Python - both variables and code - is an object. Objects
have attributes - data, basically - and methods - functions -
associated with them. (As Wesley pointed out, since pieces of code are
also objects, methods are attributes too.)<br>
<br>
However, not all objects have the same attributes or methods associated
with them! datetime.time objects have a "strftime" method, which, when
called, returns a string representation of the time. String objects do
not have any such method or data attribute, hence the error.<br>
<br>
You're showing us both too much code and too little - <br>
print "wtw self.stop_time", self.stop_time, type(self.stop_time)<br>
# set in GUI as datetime.time(6,0,0)<br>
# HEY wtw self.stop_time.strftime("%H:%M:%S")<br>
set_loc_dict[ "stop_time" ] = self.stop_time.strftime("%H:%M:%S")
<<----problem, see image in first post<br>
<br>
I'd like to see the output of that "print" - I'm pretty sure that
"type" will return "str", not "time". <br>
<br>
</div>
</div>
On another front, have you considered ConfigObj (<a
moz-do-not-send="true"
href="http://www.voidspace.org.uk/python/modules.shtml#configobj">http://www.voidspace.org.uk/python/modules.shtml#configobj</a>)?
When I first came to Python, I wrote myself a config-file handler
(serializing to XML, actually) and it worked OK - but everything was so
much work! I discovered ConfigObj and life is good. Here's a quick
example from one of my early programs I refactored to use ConfigObj
(NOT as a shining example of code, but just to show the power):<br>
<br>
<blockquote
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"
class="gmail_quote">from configobj import ConfigObj<br>
from validate import Validator</blockquote>
<div>... <br>
</div>
<blockquote
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"
class="gmail_quote"> cfgFileName = os.getcwd() + os.sep +
'fsr_1500.ini'<br>
tmpStr = """<br>
npiXMLFile = string(default="npiMap.XML")<br>
UCFformLength = integer(min=50, max=80, default=66)<br>
FIformLength = integer(min=50, max=80, default=64) <br>
OutformLength = integer(min=50, max=80, default=64) <br>
IncludeLegacy = boolean(default=False)<br>
TopLeft = int_list(min=2, max=2)<br>
BottomRight = int_list(min=2, max=2)<br>
FIHist = string_list(default=None)<br>
UCFHist = string_list(default=None)<br>
OutHist = string_list(default=None)<br>
LastRunUCF = boolean(default=True)<br>
LastRunPrinter = boolean(default=False)<br>
detailLeft = integer(min=0, max=80, default=0)<br>
detailTo = integer(min=0, max=80, default=9) <br>
detailPOS = integer(min=0, max=80, default=19)<br>
detailCode = integer(min=0, max=80, default=25)<br>
detailMods = integer(min=0, max=80, default=32)<br>
detailDiags = integer(min=0, max=80, default=44)<br>
detailCharge = integer(min=0, max=80, default=49)<br>
detailUnits = integer(min=0, max=80, default=58)<br>
detailEPSDT = integer(min=0, max=80, default=62)<br>
detailEMG = integer(min=0, max=80, default=22) <br>
detailID = integer(min=0, max=80, default=67)<br>
bodyLeftBlock = integer(min=0, max=80, default=0)<br>
bodyMidBlock = integer(min=0, max=80, default=24)<br>
bodyRightBlock = integer(min=0, max=80, default=49)<br>
bodyLabelEdge = integer(min=0, max=80, default=40)<br>
ConfirmSuccess = boolean(default=True)<br>
"""<br>
cfgSpec = StringIO.StringIO(tmpStr)<br>
cfgFile = ConfigObj(cfgFileName, <br>
configspec=cfgSpec, raise_errors=True,
write_empty_values=True, <br>
create_empty=True, indent_type=' ', list_values=True)<br>
vtor = Validator()</blockquote>
<div>...<br>
<blockquote
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"
class="gmail_quote"> cfgFile['TopLeft'] = data.GetMarginTopLeft()
# writing a couple of values<br>
cfgFile['BottomRight'] = data.GetMarginBottomRight()<br>
</blockquote>
...<br>
</div>
<blockquote
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"
class="gmail_quote"> test = cfgFile.validate(Global.vtor, copy=True)<br>
cfgFile.write()<br>
</blockquote>
<br>
Looking at that, I see a few things I want to clean up. That's the
danger (and advantage) of exposing your own code to public scrutiny...<br>
<br>
-- <br>
<a moz-do-not-send="true" href="http://www.fsrtechnologies.com">www.fsrtechnologies.com</a><br>
<pre wrap=""><hr size="4" width="90%">
_______________________________________________
Tutor maillist - <a class="moz-txt-link-abbreviated"
href="mailto:Tutor@python.org">Tutor@python.org</a>
<a class="moz-txt-link-freetext"
href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a>
</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<meta content="text/html;" http-equiv="Content-Type">
<title>Signature.html</title>
<pre class="moz-signature" cols="76"> Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)
<font color="#330099"> </font>
<span style="font-weight: bold;"></span><b><b
style="color: rgb(204, 51, 204);" class="b"><span
style="color: rgb(255, 153, 255);"></span><span
style="font-family: monospace;"></span></b></b>
"Nature, to be commanded, must be obeyed."
-- Sir Francis Bacon
</pre>
<div style="margin-left: 40px;">
<b><b style="color: rgb(204, 51, 204);" class="b"><span
style="font-family: monospace;"></span></b></b></div>
<pre class="moz-signature" cols="76"><b><b
style="color: rgb(204, 51, 204);" class="b"><span
style="font-family: monospace; color: rgb(153, 51, 153);"></span></b></b><b
style="color: rgb(204, 51, 204);" class="b"><span
style="font-family: monospace; color: rgb(153, 51, 153);"></span></b><span
style="color: rgb(153, 51, 153);"></span><span
style="color: rgb(153, 51, 153);">
</span><span style="color: rgb(153, 51, 153);"></span><b
style="color: rgb(204, 51, 204);" class="b"><span
style="font-family: monospace;"></span></b><span
style="color: rgb(204, 51, 204);"></span> Web Page: <<a
class="moz-txt-link-abbreviated"
href="http://www.speckledwithstars.net/">www.speckledwithstars.net/</a>></pre>
</div>
</body>
</html>