我正在学习Kivy用Python制作应用程序。每当我运行如下的kivy代码时:
from kivy.app import App
from kivy.uix.widget import Widget
class MyPaintWidget(Widget):
pass
class MyPaintApp(App):
def build(self):
return MyPaintWidget()
if __name__=="__main__":
MyPaintApp().run()
黑色的窗户打开了,因为它应该并且每件事似乎都工作正常。但是我在终端上收到这些消息。为什么会出现这些?这与Kivy的安装有关吗?我该如何解决潜在问题?
[INFO ] [Logger ] Record log in /home/amir/.kivy/logs/kivy_16-07-10_5.txt
[INFO ] [Kivy ] v1.9.1
[INFO ] [Python ] v2.7.9 (default, Mar 1 2015, 12:57:24)
[GCC 4.9.2]
[INFO ] [Factory ] 179 symbols loaded
[INFO ] [Image ] Providers: img_tex, img_dds, img_gif, img_sdl2, img_pil (img_ffpyplayer ignored)
[INFO ] [OSC ] using <multiprocessing> for socket
[INFO ] [Window ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO ] [GL ] OpenGL version <3.0 Mesa 10.3.2>
[INFO ] [GL ] OpenGL vendor <Intel Open Source Technology Center>
[INFO ] [GL ] OpenGL renderer <Mesa DRI Intel(R) HD Graphics 5500 (Broadwell GT2) >
[INFO ] [GL ] OpenGL parsed version: 3, 0
[INFO ] [GL ] Shading version <1.30>
[INFO ] [GL ] Texture max size <8192>
[INFO ] [GL ] Texture max units <32>
[INFO ] [Window ] auto add sdl2 input provider
[INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
[INFO ] [ProbeSysfs ] device match: /dev/input/event4
[INFO ] [MTD ] Read event from </dev/input/event4>
[INFO ] [Base ] Start application main loop
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/usr/lib/python2.7/dist- packages/kivy/input/providers/mtdev.py", line 219, in _thread_run
_device = Device(_fn)
File "/usr/lib/python2.7/dist-packages/kivy/lib/mtdev.py", line 131, in __init__
self._fd = os.open(filename, os.O_NONBLOCK | os.O_RDONLY)
OSError: [Errno 13] Permission denied: '/dev/input/event4'
答案 0 :(得分:0)
错误表示权限被拒绝。
这意味着您需要访问/ dev / input / event4的权限
尝试以root身份运行代码,或授予用户访问权限的/ dev /输入/ EVENT4