Re: [Tutor] Changing the Attribute of a Variable

2009-02-18 Thread Alan Gauld
"Wayne Watson" wrote Maybe the web documents should warn about the horrors of eval. VBG. Possibly the same is true of exec? Yes the same is true of exec and also potentially execfile. All need to be used with extreme care where there is any risk of the executed code being tampered with out

Re: [Tutor] Changing the Attribute of a Variable

2009-02-18 Thread Alan Gauld
"Wayne Watson" wrote I'll look into Quick Edit. I use Snagit to screen capture. Quick edit allows you to use the mouse to select text on the console screen then use the Enter key to copy it to the clipboard. So to paste an error message into an email simple select it with the mouse, hit

Re: [Tutor] Changing the Attribute of a Variable

2009-02-18 Thread Wayne Watson
Title: Signature.html Thanks. I'm onboard with the changes Marc and you, as below, suggest, and will very, very likely grab onto ConfigObj. I'll look into Quick Edit. I use Snagit to screen capture. One of the most useful tools I've come across in a long time. The real meat to this code is no

Re: [Tutor] Changing the Attribute of a Variable

2009-02-18 Thread Wayne Watson
Title: Signature.html Thanks very much for the comments. Definitely food for thought and helpful. I'll review them more completely  later today. I'd say chances of me switching to ConfigObj are high. Yes, about config_var_list was supposed to be a list. That was caused by confusion over synta

Re: [Tutor] Changing the Attribute of a Variable

2009-02-18 Thread Martin Walsh
Marc Tompkins wrote: > Also - config_var_list is a tuple of lists. (I'm guessing you intended > to make it a list of lists - that's what the name indicates, after all - > but putting it between "( )" makes it a tuple.) Sound advice, but a subtle clarification is warranted I think. It's the comm

Re: [Tutor] Changing the Attribute of a Variable

2009-02-18 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 7:09 PM, Wayne Watson wrote: I have a few notes, but first I just have to say: you're working very hard to implement an ordered dictionary, and you really, really don't need to. Python's (unordered) dictionaries work just fine for reading and writing configurations; you jus

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Wayne Watson
Yes, on F3 (ctrl-F). I use it a lot.  After the dust clears on how to correct this implementation, I'll give ConfigObj more consideration.  (I think a subsequent post I made with two images in it showing the layout of the program in action got side tracked here. I got a msg from the list, sayin

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 11:01 AM, Wayne Watson 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

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Kent Johnson
On Tue, Feb 17, 2009 at 7:44 AM, Wayne Watson wrote: > ==OpenConfigFile== > def OpenConfigFile(self): > def time_tuple(tstring): > t = tstring.split(':') > print 'here is t', t > tnum = () > for j in range(0,len(t)): >

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Wayne Watson
Title: Signature.html Yes, about public scrutiny of code and your paragraphs on "Everything.." and "However, not all..."-- both  understood. Here's the print from the code line below. Second line from the top. Regarding, ConfigObj, I was aware of it when I decided to go this route. That's t

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread wesley chun
> # Date vars should be type datetime.time > config_value = str(stime) this is pretty much the offending code right here... in fact, the comment contradicts the assignment. it says that date vars should be of type datetime.time, yet it assigns a *string* to config_value

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 4:44 AM, Wayne Watson wrote: > Note that the diagnostic output in the image shows attributeError: 'str' > object has no attribute 'strftime'. > > Let me see if I clarify what's really going on by including some of the > code. > Everything in Python - both variables and cod

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Wayne Watson
Note that the diagnostic output in the image shows attributeError: 'str' object has no attribute 'strftime'. Let me see if I clarify what's really going on by including some of the code. In Sentinel_GUI, the mainloop, the code shows (hard coded default values): ... self.slowdown

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread Marc Tompkins
On Tue, Feb 17, 2009 at 12:16 AM, wesley chun wrote: > marc: i will slightly disagree with you with regards to strftime *not* > being an attribute. it *is* an attribute, just not a *data > attribute*... i call it a "function attribute," but that's just > terminology. any time you have an object x

Re: [Tutor] Changing the Attribute of a Variable

2009-02-17 Thread wesley chun
>> Initally, a variable. self.stop_time is created as type datetime.time, >> with the default value 06:00:00, a time stamp, during entry into the >> mainloop. self.stop_time = datetime.time(10,10,10). The user reads his >> configuration file with the time stamp value of 08:00:00. self.time_stop >>

Re: [Tutor] Changing the Attribute of a Variable

2009-02-16 Thread Marc Tompkins
On Mon, Feb 16, 2009 at 8:24 PM, Wayne Watson wrote: > I suspect I'm in need of setattr for this in a GUI program I'm modifying. > > Initally, a variable. self.stop_time is created as type datetime.time, with > the default value 06:00:00, a time stamp, during entry into the mainloop. > self.stop_

Re: [Tutor] Changing the Attribute of a Variable

2009-02-16 Thread Wayne Watson
Title: Signature.html Thanks for the tips. It's a 2000 line program, written by someone else. I'm not fluent in Python, yet, but making good progress in implementing new features. The various  'attr'  facilities are a bit esoteric, but look useful. The often found, by Google "x.foobar=123", exa

Re: [Tutor] Changing the Attribute of a Variable

2009-02-16 Thread wesley chun
On Mon, Feb 16, 2009 at 8:24 PM, Wayne Watson wrote: > I suspect I'm in need of setattr for this in a GUI program I'm modifying. > > Initally, a variable. self.stop_time is created as type datetime.time, with > the default value 06:00:00, a time stamp, during entry into the mainloop. > self.stop_t

[Tutor] Changing the Attribute of a Variable

2009-02-16 Thread Wayne Watson
Title: Signature.html I suspect I'm in need of setattr for this in a GUI program I'm modifying. Initally, a variable. self.stop_time is created as type datetime.time, with the default value 06:00:00, a time stamp, during entry into the mainloop. self.stop_time = datetime.time(10,10,10). The us