On Mon, Feb 16, 2009 at 8:24 PM, Wayne Watson <sierra_mtnv...@sbcglobal.net>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_time = datetime.time(10,10,10). The user reads his configuration > file with the time stamp value of 08:00:00. self.time_stop becomes type > string. He then goes to a dialog to change time stop, and it tries to access > self.time_stop, and find is needs to have the attribute strftime, as in: > set_loc_dict[ "stop_time" ] = self.stop_time.strftime("%H:%M:%S") > When reading the configuration file, how do I make sure that self.time_stop > is really has the strftime attribute? > You already received an answer to your immediate question, but I wanted to clarify: "strftime" is NOT an attribute, it's a method. Calling the strftime method of a time object returns a string, formatted according to the pattern you specify - so what you're storing as "stop_time" is not a time, but a string. -- www.fsrtechnologies.com
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor