0

我正在学习使用 Python 制作应用程序的 Kivy。每当我运行如下的 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'
4

1 回答 1

0

错误说权限被拒绝。

这意味着您需要访问 /dev/input/event4 的权限

尝试以 root 身份运行代码,或授予用户访问 /dev/input/event4 的权限

于 2016-07-10T22:01:43.017 回答