PDA

View Full Version : WMD error AFTER connecting to wiimote



Acapulco
February 2nd, 2008, 05:04 AM
Hi. I'm new to this forums and I was hoping someone could help me with WMD and Ubuntu 7.10, as I can't find any other place more suitable for this question.

I've managed to get a successful connection to my Wiimote using WMD.py, although I get the following error:


acapulco@LaOla:~/wmd/wmd-0.1.2$ sudo python WMD.py
Registering key BTN_RIGHT for button A with code 111
Registering key BTN_LEFT for button B with code 110
Registering key ['KEY_LEFTCTRL', 'KEY_LEFTALT', 'BTN_LEFT'] for button D with code 1d
Registering key ['KEY_LEFTCTRL', 'KEY_LEFTALT', 'BTN_LEFT'] for button D with code 38
Registering key ['KEY_LEFTCTRL', 'KEY_LEFTALT', 'BTN_LEFT'] for button D with code 110
Registering key ['KEY_LEFTALT'] for button L with code 38
Registering key KEY_1 for button 1 with code 2
Registering key KEY_2 for button 2 with code 3
Registering key ['KEY_LEFTCTRL'] for button U with code 1d
Registering key ['KEY_F8'] for button R with code 42
[[1074025828, 2], [1074025830, 0], [1074025830, 1], [1074025828, 1], [1074025828, 0], [1074025829, 273], [1074025829, 272], [1074025829, 29], [1074025829, 56], [1074025829, 272], [1074025829, 56], [1074025829, 2], [1074025829, 3], [1074025829, 29], [1074025829, 66]]
CONNECTING
Looking for Wiimote services at address 00:19:1D:62:60:E9
Victory! We have found that Wiimote!
We are now connected to Wiimote at address 00:19:1D:62:60:E9
CONNECTED
Traceback (most recent call last):
File "WMD.py", line 45, in <module>
wmd = WMD()
File "WMD.py", line 41, in __init__
cycles = wm.main_loop()
File "/home/acapulco/wmd/wmd-0.1.2/wmd/Wiimote/WMManager.py", line 42, in main_loop
self.parser.parse( data )
File "/home/acapulco/wmd/wmd-0.1.2/wmd/Wiimote/Input.py", line 102, in parse
self.split_report( report, type )
File "/home/acapulco/wmd/wmd-0.1.2/wmd/Wiimote/Input.py", line 119, in split_report
func( slice )
File "/home/acapulco/wmd/wmd-0.1.2/wmd/Wiimote/Input.py", line 155, in slice_STAT
self.process_stats( s )
TypeError: process_stats() takes exactly 1 argument (2 given)

The reason I want to use WMD and not some other solution is because I want to do some Python learning, so I opened up the source file, found the line and found nothing wrong:

This is the offending function:


def slice_STAT( self, slice ):
stat = bf( decbyte( slice ) )
s = {}
s['attachment'] = stat[1]
s['continuous'] = stat[3]
s['leds'] = stat[4:8]
self.process_stats( s )

Calling:


def process_stats( s ):
pass

I'm no Python Guru, but if those are the only two entries found for "process_stats" I really can't see what could be wrong. I even get the GUI to show for a couple of seconds before this error arises.

I appreciate any help and time provided

Acapulco

jpeddicord
February 2nd, 2008, 05:14 AM
Seems to be just unfinished code. If the author meant for process_stats to be used in a class, they forgot the "self" attribute.

Also, the "pass" command literally does nothing in Python. It is there just for the parser to stop complaining about empty code blocks. So it seems that the code simply is not done yet. If it should be, and this is released code, I'd recommend contacting the author/filing a bug report. Reference this post if necessary.

You might be able to comment out the line with self.process_stats(s) to try to make it work as a temporary solution. By this I mean:


def slice_STAT( self, slice ):
stat = bf( decbyte( slice ) )
s = {}
s['attachment'] = stat[1]
s['continuous'] = stat[3]
s['leds'] = stat[4:8]
# self.process_stats( s )
Jacob

Acapulco
February 2nd, 2008, 05:24 AM
Thanks a lot. That's what I thought at first after looking at the statement, nevertheless I see some people got this same version working, so I can't figure out what could be producing the error.

I have Python 2.5, does anyone know if there's some problem with it?

Thanks again!

jpeddicord
February 2nd, 2008, 05:34 AM
If the library is written for 2.4, it is probably not going to work with 2.5 due to some incompatibilities between the versions. You can install Python 2.4 alongside 2.5 (in fact it may already be installed). Instead of running "python" at the terminal, try "python2.4".

(Moving to Programming Talk, the thread will get more attention there)

Acapulco
February 2nd, 2008, 06:06 PM
Thanks again jacob, I have finally found the error.

It turns out that the "other" parameter being passed is apparently generated by the Nunchuk.

At first I installed Python 2.4 per your suggestion the same error was still there,so then I commented the line you said but then the error came from some other library.

In the end, if only the Wiimote is connected (no nunchuk) it will work with 2.4 AND 2.5, at least in Gutsy.

I'm not sure if the project is still being actively developed as I haven't found any official or unofficial page with any forums or anything, so the last version I'm aware of is WMD 0.1.2 (obtained from CircuitDB http://www.circuitdb.com/articles/7/3).

UBfusion
February 16th, 2008, 02:59 AM
Acapulco, WMD for me worked without any code modification (Gutsy amd64, python 2.5). Have you checked your Config.py ? Read my post in http://ubuntuforums.org/showthread.php?t=317047

Acapulco
February 16th, 2008, 08:32 AM
Thanks UBFusion. I forgot to edit the post to say that I solved it. I figured you get the error whenever you have a nunchuk or otherwise connected to the expansion port.

I also found WMD to be way too hard to modify, specially without docs to be used by me, so I'm trying to develop my own Wii Python driver. Ill let you know if you want when I get a working version :)