Setattr question

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Cactus Offline
Posts: 50
Joined: Feb 2005
Reputation: 0
Post: #1

if tried this:

Quote:varname = 'myvar'
varvalue = 'myval'
setattr(self, varname, varvalue)

this seems to work; when i print self.myvar it outputs myval. when i try to use it for other things like self.addcontrol(self.myvar) it outputs this error:

Quote:traceback (most recent call last):
 file "c:\documents and settings\wyseterm\desktop\tvg\", line 302, in ?
   gids = tvguide()
 file "c:\documents and settings\wyseterm\desktop\tvg\", line 101, in
 file "c:\python24\lib\", line 115, in addcontrol
attributeerror: 'str' object has no attribute 'create'

any idea how to get around it? what i wanted was a use a list[] to add controls for the xbmcgui but i don't seem to get it to work. anyone else ever did this, adding controls from lists?

any help/hint is really appreciated.

find quote