0

this is my first leap Motion application using python. this is my code :

    import Leap,sys,thread,time
    from Leap import CircleGesture,KeyTapGesture,ScreenTapGesture,SwipeGesture,\
    Listener


class LeapMotionListener(Leap,Listener):
    finger_name = ['a','b','c','d','e']
    bone_name = ['a1','b1','c1','d1']
    state_name =['s1','s2','s3','s4']

    def on_init(self, controller):
        print('initialized')

    def on_connect(self, controller):
        print('connected')
        controller.enable_gesture(Leap.Gesture.TYPE_CIRCLE)
        controller.enable_gesture(Leap.Gesture.TYPE_KEY_TAP)
        controller.enable_gesture(Leap.Gesture.TYPE_SCREEN_TAP)
        controller.enable_gesture(Leap.Gesture.TYPE_SWIPE)

    def on_disconnect(self, controller):
        print('disconnected')

    def on_exit(self, controller):
        print('Exited')

    def on_frame(self, controller):
        pass

    def main(self):
        listener = LeapMotionListener()
        controller = Leap.Controller()
        controller.add_listener(listener)

        print('press enter to quit')
        try:
            sys.stdin.readline()
        except KeyboardInterrupt:
            pass
        finally:
            controller.remove_listener(listener)

if __name__ == "__main__":
    LeapMotionListener.main()

but i get this error :

Traceback (most recent call last): File "C:\Users\Qutaiba\workspace\3D_Painter\src\aa.py", line 1, in import Leap,sys,thread,time File "C:\Users\Qutaiba\workspace\3D_Painter\src\Leap.py", line 28, in LeapPython = swig_import_helper() File "C:\Users\Qutaiba\workspace\3D_Painter\src\Leap.py", line 24, in swig_import_helper _mod = imp.load_module('LeapPython', fp, pathname, description) ImportError: DLL load failed: %1 is not a valid Win32 application.

i tried python 2.7 and 3.4 and the same error shows ! i read that i should install win32api, i installed it but nothing changed .. can anyone help ?

Qutaiba
  • 145
  • 1
  • 13
  • try adding the location of the DLL (and the Leap modules) to the PYTHONPATH. See [here](https://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-7) – IronManMark20 May 13 '15 at 21:58
  • There's documentation on setting this up here: https://developer.leapmotion.com/documentation/python/devguide/Project_Setup.html – Charles Ward May 14 '15 at 14:17

0 Answers0