Kivy(Python)程序在Raspberry Pi上崩溃(crashlog)

时间:2015-01-11 09:10:10

标签: python raspberry-pi kivy

我最近按照Kivy网站上的说明在Raspberry Pi(使用Raspbian系统)上安装了Kivy。

我打算测试我写的程序。它在我的Linux Mint计算机上运行良好。然而,在Raspbian上,它崩溃了一个奇怪的错误链接到Kivy自己的一个函数。

这里是终端输出:

$ python main.py
[INFO   ] [Logger      ] Record log in /home/pi/.kivy/logs/kivy_15-01-10_6.txt
[INFO   ] Kivy v1.9.0-dev
[INFO   ] [Python      ] v2.7.3 (default, Mar 18 2014, 05:13:23) 
[GCC 4.6.3]
[INFO   ] [Factory     ] 173 symbols loaded
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_gif, img_pygame (img_pil, img_ffpyplayer ignored)
[INFO   ] [Window      ] Provider: egl_rpi
[INFO   ] [GL          ] OpenGL version <OpenGL ES 2.0>
[INFO   ] [GL          ] OpenGL vendor <Broadcom>
[INFO   ] [GL          ] OpenGL renderer <VideoCore IV HW>
[INFO   ] [GL          ] OpenGL parsed version: 2, 0
[INFO   ] [GL          ] Shading version <OpenGL ES GLSL ES 1.00>
[INFO   ] [GL          ] Texture max size <2048>
[INFO   ] [GL          ] Texture max units <8>
[INFO   ] [Shader      ] fragment shader: <Compiled>
[INFO   ] [Shader      ] vertex shader: <Compiled>
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event0
[INFO   ] [HIDInput    ] Read event from </dev/input/event0>
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event1
[INFO   ] [HIDInput    ] Read event from </dev/input/event1>
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event2
[INFO   ] [HIDInput    ] Read event from </dev/input/event2>
[INFO   ] [Base        ] Start application main loop
[INFO   ] [HIDMotionEvent] using <CHESEN USB Keyboard>
[INFO   ] [HIDMotionEvent] using <CHESEN USB Keyboard>
[INFO   ] [HIDMotionEvent] using <PixArt USB Optical Mouse>
[INFO   ] [Base        ] Leaving application in progress...
 Traceback (most recent call last):
   File "main.py", line 145, in <module>
     MainApp().run()
   File "/usr/local/lib/python2.7/dist-packages/kivy/app.py", line 825, in run
     runTouchApp()
   File "/usr/local/lib/python2.7/dist-packages/kivy/base.py", line 484, in runTouchApp
     EventLoop.window.mainloop()
   File "/usr/local/lib/python2.7/dist-packages/kivy/core/window/window_egl_rpi.py", line 77, in mainloop
     self._mainloop()
   File "/usr/local/lib/python2.7/dist-packages/kivy/core/window/window_egl_rpi.py", line 72, in _mainloop
     EventLoop.idle()
   File "/usr/local/lib/python2.7/dist-packages/kivy/base.py", line 324, in idle
     Clock.tick()
   File "/usr/local/lib/python2.7/dist-packages/kivy/clock.py", line 483, in tick
     self._process_events()
   File "/usr/local/lib/python2.7/dist-packages/kivy/clock.py", line 615, in _process_events
     event.tick(self._last_tick, remove)
   File "/usr/local/lib/python2.7/dist-packages/kivy/clock.py", line 374, in tick
     ret = callback(self._dt)
 TypeError: create_window() takes exactly 1 argument (2 given)

就像一个疯狂的猜测,看看它是如何工作的,我试着编辑Kivy&#34; create_window()&#34;函数,位于&#34; /usr/local/lib/python2.7/dist-packages/kivy/core/window/window_egl_rpi.py"中,通过在其声明中添加可选参数。再次运行我的程序产生了某种分段错误,所以我不再搞乱Kivy的代码......

知道如何修复此日志中提示的错误吗? (MainApp()。run()是我程序的最开始,其他一切都是Kivy函数,显然是由这个命令自动调用的)

1 个答案:

答案 0 :(得分:5)

我遇到了同样的错误,同样的情况 - 我的程序在Windows机器上运行良好,但在RPi上崩溃时出现相同的错误。就我而言,我正在运行更新的Python版本--2.7.9。

Window.size 分配似乎是崩溃的来源:

class MainApp(App):
  def build(self):
    Window.size = (1280,800)     # <---- Crashes on RPi

删除此作业修复了该程序。