3
有沒有人有任何想法爲什麼這段代碼給出了分段錯誤?Kivy代碼分段錯誤
從nodeapp.py
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.floatlayout import FloatLayout
class Node(Widget):
def __init__(self):
pass
inputs = 1
function = "add"
class NodeApp(App):
def build(self):
fl = FloatLayout()
nod = Node()
fl.add_widget(nod)
return fl
if __name__ == '__main__':
NodeApp().run()
從node.kv
<Node>:
size: 0.5,0.5
canvas:
Rectangle:
pos: 1,1
日誌:
botstrapping Kivy @ D:\CPPP\
Setting Environment Variables:
#################################
GST_REGISTRY
D:\CPPP\gstreamer\registry.bin
---------------
GST_PLUGIN_PATH:
D:\CPPP\gstreamer\lib\gstreamer-1.0
---------------
PATH:
D:\CPPP\;D:\CPPP\Python27;D:\CPPP\tools;D:\CPPP\Python27\Scripts;D:\CPPP\gstream
er\bin;D:\CPPP\MinGW\bin;C:\Program Files\CollabNet\Subversion Client;C:\Program
Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows
;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;D:\AMD\ATI
.ACE\Core-Static;C:\Program Files\MATLAB\MATLAB Compiler Runtime\v81\runtime\win
64;C:\Program Files (x86)\MATLAB\MATLAB Compiler Runtime\v81\runtime\win32;D:\no
dejs\;C:\Python27\;C:\Program Files (x86)\Wiimm\WIT;C:\Program Files (x86)\ATI T
echnologies\ATI.ACE\Core-Static;C:\Program Files\Common Files\Microsoft Shared\W
indows Live;C:\Program Files (x86)\Nmap;C:\Users\a\AppData\Roaming\npm;C:\Python
27\;C:\Program Files (x86)\Wiimm\WIT
----------------------------------
PYTHONPATH:
D:\CPPP\kivy;
----------------------------------
##################################
done bootstraping kivy...have fun!\n
running "python.exe D:\CPPP\nodeapp.py" \n
[INFO ] Kivy v1.8.0
[INFO ] [Logger ] Record log in C:\Users\a\.kivy\logs\kivy_14-
09-20_78.txt
[INFO ] [Factory ] 157 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
_gif (img_pil ignored)
[DEBUG ] [Cache ] register <kv.texture> with limit=1000, timeo
ut=60s
[DEBUG ] [Cache ] register <kv.shader> with limit=1000, timeou
t=3600s
[INFO ] [Text ] Provider: pygame
[DEBUG ] [App ] Loading kv <D:\CPPP\node.kv>
[DEBUG ] [Window ] Ignored <egl_rpi> (import error)
[INFO ] [Window ] Provider: pygame(['window_egl_rpi'] ignored)
[DEBUG ] [Window ] Display driver windib
[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: 2
GLEW initialization succeeded
[INFO ] [GL ] OpenGL version <4.4.12967 Compatibility Prof
ile Context 14.200.1004.0>
[INFO ] [GL ] OpenGL vendor <ATI Technologies Inc.>
[INFO ] [GL ] OpenGL renderer <AMD Radeon HD 7800 Series>
[INFO ] [GL ] OpenGL parsed version: 4, 4
[INFO ] [GL ] Shading version <4.40>
[INFO ] [GL ] Texture max size <16384>
[INFO ] [GL ] Texture max units <32>
[DEBUG ] [Shader ] Fragment compiled successfully
[DEBUG ] [Shader ] Vertex compiled successfully
[DEBUG ] [ImagePygame ] Load <D:\CPPP\kivy\kivy\data\glsl\default.pn
g>
[INFO ] [Window ] virtual keyboard not allowed, single mode, n
ot docked
Fatal Python error: (pygame parachute) Segmentation Fault
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Press any key to continue . . .
谷歌搜索的問題,使我更新我的顯卡司機(現在在1 4.7 RC,最新版本)和使用ensure_window(),兩者都沒有解決問題。
註釋掉__init__解決分段錯誤,但使我不能用__init__任何東西