Kodi Community Forum

Full Version: Setattr question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hi,

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\tvg.py", line 302, in ?
   gids = tvguide()
 file "c:\documents and settings\wyseterm\desktop\tvg\tvg.py", line 101, in
   self.addcontrol(self.vandaag0)
 file "c:\python24\lib\xbmcgui.py", line 115, in addcontrol
   control.create(self)
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.

tia,
cheers
cactus