简体   繁体   中英

Python Kivy Attribute Error

I installed Kivy from ppa:kivy-team/kivy but got AttributeError: 'module' object has no attribute 'instancemethod'

I reinstalled it but still the same error appears. I have tried ppa:kivy-team/kivy-daily and from the official ubuntu repositories but the error occurs in all. My code is the Hello World application from here . My filename is kivyhw.py (if that's what's going wrong.) Python v2.7

Here is the entire message from the one from the official repos:

[INFO   ] Kivy v1.7.2
Purge log fired. Analysing...
Purge finished !
[INFO   ] [Logger      ] Record log in /home/aditya/.kivy/logs/kivy_15-06-03_19.txt
[INFO   ] [Factory     ] 144 symbols loaded
[DEBUG  ] [Cache       ] register <kv.lang> with limit=None, timeout=Nones
[DEBUG  ] [Cache       ] register <kv.image> with limit=None, timeout=60s
[DEBUG  ] [Cache       ] register <kv.atlas> with limit=None, timeout=Nones
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_pygame, img_pil, img_gif 
[DEBUG  ] [Cache       ] register <kv.texture> with limit=1000, timeout=60s
[DEBUG  ] [Cache       ] register <kv.shader> with limit=1000, timeout=3600s
[INFO   ] [Text        ] Provider: pygame
[DEBUG  ] [App         ] Loading kv <Documents/Python/my.kv>
[DEBUG  ] [App         ] kv <Documents/Python/my.kv> not found
[DEBUG  ] [Window      ] Ignored <egl_rpi> (import error)
[INFO   ] [Window      ] Provider: pygame(['window_egl_rpi'] ignored)
libudev: udev_device_new_from_syspath: device 0x973d8d0 has devpath '/devices/pci0000:00/0000:00:02.0/drm/card0'
libudev: udev_device_new_from_syspath: device 0x973dd10 has devpath '/devices/pci0000:00/0000:00:02.0'
libudev: udev_device_read_db: device 0x973dd10 filled with db file data
[WARNING] [WinPygame   ] Video: failed (multisamples=2)
[WARNING] [WinPygame   ] trying without antialiasing
[DEBUG  ] [Window      ] Display driver x11
[DEBUG  ] [Window      ] Actual window size: 800x600
[DEBUG  ] [Window      ] Actual color bits r8 g8 b8 a8
[DEBUG  ] [Window      ] Actual depth bits: 24
[DEBUG  ] [Window      ] Actual stencil bits: 8
[DEBUG  ] [Window      ] Actual multisampling samples: 0
[INFO   ] [GL          ] OpenGL version <1.4 Mesa 10.1.3>
[INFO   ] [GL          ] OpenGL vendor <Intel Open Source Technology Center>
[INFO   ] [GL          ] OpenGL renderer <Mesa DRI Intel(R) 945GM x86/MMX/SSE2>
[INFO   ] [GL          ] OpenGL parsed version: 1, 4
[CRITICAL] [GL          ] Minimum required OpenGL version (2.0) NOT found!

OpenGL version detected: 1.4

Version: 1.4 Mesa 10.1.3
Vendor: Intel Open Source Technology Center
Renderer: Mesa DRI Intel(R) 945GM x86/MMX/SSE2

Try upgrading your graphics drivers and/or your graphics hardware in case of problems.

The application will leave now.
[INFO   ] [GL          ] Shading version <1.20>
[INFO   ] [GL          ] Texture max size <2048>
[INFO   ] [GL          ] Texture max units <8>
[DEBUG  ] [Shader      ] Fragment compiled successfully
[DEBUG  ] [Shader      ] Vertex compiled successfully
[DEBUG  ] [ImagePygame ] Load </usr/lib/python2.7/dist-packages/kivy/data/glsl/default.png>
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [OSC         ] using <multiprocessing> for socket
[DEBUG  ] [Base        ] Create provider from mouse
[DEBUG  ] [Base        ] Create provider from probesysfs
[DEBUG  ] [ProbeSysfs  ] using probsysfs!
[INFO   ] [Base        ] Start application main loop
[INFO   ] [Base        ] Leaving application in progress...
[INFO   ] [Base        ] Leaving application in progress...
 Traceback (most recent call last):
   File "Documents/Python/kivyhw.py", line 15, in <module>
     MyApp().run()
   File "/usr/lib/python2.7/dist-packages/kivy/app.py", line 600, in run
     runTouchApp()
   File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 456, in runTouchApp
     stopTouchApp()
   File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 466, in stopTouchApp
     EventLoop.close()
   File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 160, in close
     self.stop()
   File "/usr/lib/python2.7/dist-packages/kivy/base.py", line 172, in stop
     provider.stop()
   File "/usr/lib/python2.7/dist-packages/kivy/input/providers/mouse.py", line 125, in stop
     on_mouse_up=self.on_mouse_release)
   File "_event.pyx", line 261, in kivy._event.EventDispatcher.unbind (kivy/_event.c:3793)
   File "/usr/lib/python2.7/dist-packages/kivy/weakmethod.py", line 48, in __call__
     return new.instancemethod(self._func, self._obj(), self._class)
 AttributeError: 'module' object has no attribute 'instancemethod'

The problem was that your file new.py was imported instead of the one internal to python. It's a rare but annoying bug!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM