error

9 views
Skip to first unread message

purushottam yadav

unread,
Sep 12, 2022, 12:47:09 AM9/12/22
to Kivy users support
Help me  with  this error .

[INFO   ] [Base        ] Leaving application in progress...
 Traceback (most recent call last):
   File "kivy/properties.pyx", line 861, in kivy.properties.ObservableDict.__getattr__
 KeyError: 'scroll_parent'
 
 During handling of the above exception, another exception occurred:
 
 Traceback (most recent call last):
   File "main.py", line 1938, in <module>
     k.run()
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/app.py", line 950, in run
     runTouchApp()
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/base.py", line 582, in runTouchApp
     EventLoop.mainloop()
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/base.py", line 347, in mainloop
     self.idle()
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/base.py", line 391, in idle
     self.dispatch_input()
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/base.py", line 342, in dispatch_input
     post_dispatch_input(*pop(0))
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/base.py", line 308, in post_dispatch_input
     wid.dispatch('on_touch_up', me)
   File "kivy/_event.pyx", line 709, in kivy._event.EventDispatcher.dispatch
   File "/home/purushottamdev/directory_env/f/ff/kivymd/uix/behaviors/ripplebehavior.py", line 294, in on_touch_up
     return super().on_touch_up(touch)
   File "/home/purushottamdev/directory_env/f/ff/kivymd/uix/button.py", line 947, in on_touch_up
     return super().on_touch_up(touch)
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/behaviors/button.py", line 179, in on_touch_up
     self.dispatch('on_release')
   File "kivy/_event.pyx", line 705, in kivy._event.EventDispatcher.dispatch
   File "kivy/_event.pyx", line 1248, in kivy._event.EventObservers.dispatch
   File "kivy/_event.pyx", line 1132, in kivy._event.EventObservers._dispatch
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/lang/builder.py", line 57, in custom_callback
     exec(__kvlang__.co_value, idmap)
   File "<string>", line 328, in <module>
   File "main.py", line 1872, in ca
     self.help_str.get_screen('searchscreen').ids.displaying.add_widget(Post_12(name = 'purushottam' ,
   File "main.py", line 1131, in __init__
     super().__init__(**kw)
   File "main.py", line 1064, in __init__
     super().__init__(**kw)
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/behaviors/button.py", line 121, in __init__
     super(ButtonBehavior, self).__init__(**kwargs)
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/boxlayout.py", line 145, in __init__
     super(BoxLayout, self).__init__(**kwargs)
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/layout.py", line 76, in __init__
     super(Layout, self).__init__(**kwargs)
   File "/home/purushottamdev/directory_env/f/ff/kivymd/uix/behaviors/backgroundcolorbehavior.py", line 138, in __init__
     super().__init__(**kwargs)
   File "/home/purushottamdev/directory_env/f/lib/python3.8/site-packages/kivy/uix/widget.py", line 350, in __init__
     super(Widget, self).__init__(**kwargs)
   File "kivy/_event.pyx", line 264, in kivy._event.EventDispatcher.__init__
   File "kivy/properties.pyx", line 498, in kivy.properties.Property.__set__
   File "kivy/properties.pyx", line 545, in kivy.properties.Property.set
   File "kivy/properties.pyx", line 600, in kivy.properties.Property.dispatch
   File "kivy/_event.pyx", line 1248, in kivy._event.EventObservers.dispatch
   File "kivy/_event.pyx", line 1154, in kivy._event.EventObservers._dispatch
   File "main.py", line 1152, in on_description
     self.ids.scroll_parent.ids.stacks_layouts_.add_widget(Bu(text = t )  )
   File "kivy/properties.pyx", line 864, in kivy.properties.ObservableDict.__getattr__
 AttributeError: 'super' object has no attribute '__getattr__'


class post_1(ButtonBehavior, MDBoxLayout):


    name = StringProperty('')
    post_source = StringProperty('')
    profile_source = StringProperty('')
    description  = StringProperty('')
    distance = StringProperty('')
    details = StringProperty('')

    lat = StringProperty('none')
    lon = StringProperty('none')
    media  = ListProperty([])


    def __init__(self, **kw):
        super().__init__(**kw)


class Post_12(post_1):
    s_up = "no"


    def __init__(self, **kw):
        super().__init__(**kw)
        #self.setup()
        #self.s_up = "no"


    def on_description(self , v , b ):
        if self.s_up == "no" :
            self.s_up = "yes"


            print( v,  b )

            time.sleep(.5)
            #posts__.ids.stacks_layouts_.clear_widgets()
            l=  3 * (Window.size[0])
            h=0
            #print(self.description , "initddd<<<<<" , self.description.split(" ") )

            for t in self.description.split(" ") :
                #print(t , "tttttt<<<<<<<<<<<<<<<<<<<<<<<<" , self.description , "dddd<<<<")

                self.ids.scroll_parent.ids.stacks_layouts_.add_widget(Bu(text = t )  )
                h += (40) * len(t) * (25)
                l += len(t)*25 + dp(5)

            s = l * dp(10)
            px = 0+0+2 *(Window.size[0]) * ( dp(10) )
            a = s + h + px
            y = (  (a)/( Window.size[0]  -  dp(20)  )+   dp(20) )

            print("mmmmmmmmmmmmmmmmmm" , self.media )

            if self.media == [] :
                #self.remove_widget(self.ids.car)
                self.post_source = ""

            else :

                while not  self.post_source :


                    for i in self.media :
                        if i['source'].endswith(".jpeg") or  i['source'].endswith(".jpg") or i['source'].endswith(".png") :
                            self.post_source = i['source']
                            break
                        elif i== len(self.media) :
                            break


                print("........not.....................")

            if self.post_source == "" :
                self.remove_widget(self.ids.car)


            self.ids.stack_parent.size_hint = (None, None)
            self.ids.stack_parent.size = [ Window.size[0] , y  ]



            #posts__.ids.stacks_layouts_.minimum_size#[ Window.size[0] ,  Window.size[1] *( len(posts__.description ) ) ]
            #self._size = [ Window.size[0] , y + Window.size[1]  + Window.size[1]      ]
            print("value ", self.post_id  , self.size  , y )
            #k.update_post_size(self.post_id , self.size  , y )






<Post_12>:
    #post_id: -1

    orientation: 'vertical'
    padding: ["0dp", "10dp","0dp", "10dp"]
    spacing: [ mtx.dp(20) ,  mtx.dp(50) ]
    adaptive_height: True



    #MDBoxLayout:
    #    adaptive_height: True
        #size_hint_y: .1
#        ThreeLineAvatarListItem:
#            size_hint_x: .7
#            text: root.name
#            bold: True
#            secondary_text: root.details
#            tertiary_text:  root.distance
#
#            ImageLeftWidget:
#                source: root.profile_source

#        MDIconButton:
#            id: map
#            icon : 'adjust'
            #text: 'follow'
            #size_hint_x: .15
#            on_press:

#                app.callback_1(root)



    MDBoxLayout:
        id: scroll_parent
        md_bg_color:(1,1,1,1)
        adaptive_height: True
        orientation: 'vertical'
        #padding: ["10dp", "10dp","10dp", "10dp"]
        #spacing: [ mtx.dp(10) ,  mtx.dp(10) ]



        MDBoxLayout:
            #size_hint_y: .08
            adaptive_height: True
            id:stack_parent
            #size_hint: (None, None)
            #size:  [ Window.size[0] ,  Window.size[1] * (5/10)  ]


            MyStackLayout:
                id:stacks_layouts_



    MDBoxLayout:
        id : car
        size_hint: (None, None)
        size:  [ Window.size[0] ,  Window.size[1] * (5/10)  ]
        padding: ["30dp", "10dp","30dp", "10dp"]
        spacing: [ mtx.dp(30) ,  mtx.dp(10) ]
        md_bg_color:(1,1,1,1)
        adaptive_height: True
        #orientation: 'vertical'




        FitImage:
            source: root.post_source
            radius: [20,]
            allow_stretch: True
            keep_ratio:True
            size_hint_x: 1
            cache : True
            #on_touch_down: root.down()


                #FitImage:
                #    source:root.profile_source
                #    allow_stretch: True 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
                #    size_hint_x: 1
                #    cache : True

                    #size_hint: (None, None)
                    #size:  [ Window.size[0] ,  Window.size[1] ]



    MDBoxLayout:
        #size_hint_y: .08
        adaptive_height: True

        MDIconButton:
            id:likebutton
            icon: "star"
            size_hint_x: .1

            theme_text_color: "Custom"
            text_color: (0,1,1,1)
            on_release:root.like_fun()

        MDIconButton:
            icon: "dots-vertical"
            size_hint_x: .1
            on_release: root.postdetails()

            theme_text_color: "Custom"
            text_color: (0,0,0)











Elliot Garbus

unread,
Sep 12, 2022, 1:06:57 AM9/12/22
to kivy-...@googlegroups.com

Is the description changing before the kv code is processed? 

That is what I think is going on.  You could try using the default initial value for StringProperty,…  StringProperty() and see if that fixes the problem.

 

Alternatively you could create an on_kv_post method, set a instance var to set a flag and ignore on_description events that occur prior to the kv being processed… or use a try except block and ignore the key error…

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/910522da-2ec4-434b-b42a-88a6787a9404n%40googlegroups.com.

 

Reply all
Reply to author
Forward
0 new messages