Kivy code segmentation fault

Does anyone know why this code is giving 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

      

Magazine:

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 support team for more information.
Press any key to continue . . .

      

The resulting issue led me to update my graphics card drivers (now at 14.7 RC, latest version) and using provide_window (), both of which did not resolve the issue.

Commenting out __init__ solves the segmentation problem, but prevents me from using __init__ for anything

+3


source to share


1 answer


I haven't checked what exactly is going wrong, but the problem is probably that your overridden is __init__

not calling the original __init__

class, which is important because this will set all the normal kivy behavior, including providing a canvas widget, etc.

Instead, you should do:



def __init__(self):
    super(Node, self).__init__()

      

+4


source







All Articles