Getting runtimewarning in oncontrol + lockup
#1
Sad 
i need need some help. i get this warning:
Quote:runtimewarning: tp_compare didn't return -1 or -2 for exception
 elif control == self.list:
in the logfile and then the xbmc gui freezes.
ftp server is still working

the warning is issued on this simple code:
Quote:def oncontrol(self, control):
if control == none:
print('none button pressed')

elif control == self.list:
print('list button pressed')
the control is created using:
Quote:self.list = xbmcgui.controllist(list_x, list_y, list_width, list_height, 'font13')
self.addcontrol(self.list)

it seems that the == operator doesn't return the expected value.
am i doing something wrong?
is there an alternative way to do the comparison?

bernd
Reply
#2
i think you simply don't need your :
if control == none
because the oncontrol def will be called when a control is called...
so just doing the following should be enough :
Quote:def oncontrol(self, control):
if control == self.list:
print('list button pressed')
else:
print('none button pressed')#but it will be printed only if the control used to call this def is not checked with a if
Reply
#3
yeah you are definatly right.
but the warning comes from the comparison with self.list

it seems that the internal comparison of the list object doesn't return the expected value. :help:
Reply
#4
I have currently the same issue, and it seems nobody found the answer why the comparison fails in this simple case.
If anybody had the same problem, please let us know how you solve it, it would be very nice.
Thanks
Reply
#5
it's None not none, unless you've defined none = None. and it's onControl not oncontrol.

if these are typing mistakes here in this thread then you need to copy/paste them, also wrap them in code blocks so indentation stays.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply

Logout Mark Read Team Forum Stats Members Help
Getting runtimewarning in oncontrol + lockup0