TypeError: integer argument expected, got float
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-uinput |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Thanks in advance...
I installed libsuinput-0.4, python-uinput-0.5, pytuio-0.1 and I tried tuiototouch.py in ubuntu 11.04.
Is there something wrong in __init__.py ?
sudo python tuiototouch.py
type :1 code : 330 value : 0
type :1 code : 330 value : 1
type :3 code :0 value :895
Traceback (most recent call last):
File "tuiototouch.py", line 121, in <module>
device.
File "tuiototouch.py", line 92, in display
self.
File "/usr/local/
suinput.
TypeError: integer argument expected, got float
Changed in python-uinput: | |
status: | New → Confirmed |
Changed in python-uinput: | |
importance: | Undecided → Medium |
assignee: | nobody → Tuomas Jorma Juhani Räsänen (tuos) |
milestone: | none → 0.6 |
Hi and thank you for reporting this!
It seems that your tuiototouch.py on line 92 is passing a float argument (self.x_mouse). Uinput expects only integers.
I think that the int-conversion could be done under the hood in suinput. So perhaps suinput should make sure that ev_value is integer before it passes it to the uinput-system.
So there are two possible solutions. I could either
- document the integer requirement for uinput. Device. emit()
or
- allow any numerical type and typecast it to integer in suinput
I'm not sure right away which is better, I'll think about it for a while.
Meanwhile, I think you can fix this by typecasting self.x_mouse to int in tuiototouch.py: int(self.x_mouse).