Does anyone have any idea why this code gives a segmentation fault?
from 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()
from node.kv
<Node>:
size: 0.5,0.5
canvas:
Rectangle:
pos: 1,1
The log:
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 . . .
Googling the issue led me to updating my graphics card drivers (now at 14.7 RC, the latest version) and using ensure_window(), both of which did not solve the issue.
Commenting out the __init__ solves the segmentation fault, but prevents me from using __init__ for anything
I haven't checked what exactly goes wrong, but the problem is probably that your overridden __init__ does not call the original __init__ of the class, which is important because that would set up all the normal kivy behaviour, including giving the widget a canvas etc.
You should instead do at least:
def __init__(self):
super(Node, self).__init__()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With