omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello β€” I'm @olemoritz on Twitter.


    Odd Crash Report

    Pythonista
    crash objc scene
    5
    15
    4662
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mikael
      mikael @stephen last edited by

      @stephen, how are you using UIImageView in scene? Maybe there is some clue there.

      How consistent is this crash?

      Also, I think you were aware of the crashiness of load_from_url, so you are probably not using it?

      stephen 1 Reply Last reply Reply Quote 0
      • stephen
        stephen @mikael last edited by

        @mikael said:

        @stephen, how are you using UIImageView in scene? Maybe there is some clue there.

        How consistent is this crash?

        Also, I think you were aware of the crashiness of load_from_url, so you are probably not using it?

        this is why its so odd.. πŸ˜¬πŸ§πŸ€“ im not using UIImageView. also nt using `load_from_url. the crash was pretty consistent, would crash about every 5 time i would us Run.. but whats even more odd is once i commented out some code that handled a pond for my game it sems to have stopped.. ill post the code.. but it probably wont run or u without everything and assets.. but ill show what i was alling how and that its all fom scene (i know scene use ui but i figured id need to exclusivly call UIImageView to get this issue)

        
        class GameController:
        	eBoxes = []
        	nodes=  []
        	main = None
        	pointer = None
        	
        	@classmethod
        	def update(cls, dt):
        		for eBox in cls.eBoxes:
        			eBox.update(dt)
        			
        	@classmethod
        	def touch_began(cls, touch):
        		cls.pointer.touch_began(touch)
        		for n in cls.nodes:
        			if n.point_from_scene(touch.location) in n.frame:
        				cls.main.update_selected(n)
        		
        	@classmethod
        	def touch_moved(cls, touch):
        		cls.pointer.touch_moved(touch)
        		
        	@classmethod
        	def touch_ended(cls, touch):
        		cls.pointer.touch_ended(touch)
        		
        
        class Pond(SpriteNode):
        	def __init__(self, p, *args, **kwargs):
        		self.texture = Texture('./desert/desert-pond-top.png')
        		self.position = Point(200, 60)
        		SpriteNode.__init__(self,
        			texture = self.texture,
        			position = self.position,
        			parent = p,
        			*args, **kwargs)
        		self.fishingSpots=[
        			Point(-350, 100),
        			Point(50, -200),
        			Point(50, 225),
        			Point(325, 100)]
        		self.fishingNodes=[
        			FishingSpotBrush(self, [], position=Point(0, 0)),
        			FishingSpotBrush(self, [], position=Point(0, 0))]
        		for brush in self.fishingNodes:
        			from random import choice
        			x, y = choice(self.fishingSpots)
        			brush.run_action(Action.move_to(x, y, 5))
        			
        	self.Animate()
        			def Animate(self):
        		scale = move = alpha=[]
        		r = rx = ry = 0
        		for x in range(100):
        			r=random.random()
        			inRange = 0.80 < r < 1
        			if inRange:
        				scale.append(a.scale_to(r + 0.10, 5, TIMING_SINODIAL))
        				alpha.append(a.fade_to(r - 0.10, 5, TIMING_SINODIAL))
        			rx, ry=random.randrange(5, 30), random.randrange(5, 10)
        			move.append(a.move_by(rx, ry, 5, TIMING_SINODIAL))
        			move.append(a.move_by(-rx, -ry, 5, TIMING_SINODIAL))
        		self.run_action(
        			a.repeat(
        				a.group(
        					a.sequence(scale),
        					a.sequence(move)), -1))
        
        class DevMapDesert(SpriteNode):
        	def __init__(self, p, *args, **kwargs):
        		self.texture = Texture('./desert/desert-testing.png')
        		self.size = Size(4096, 4096)
        		SpriteNode.__init__(self,
        			texture = self.texture,
        			size =vself.size,
        			parent = p,
        			*args, **kwargs)
        			
        		self.pondWater=Pond(self)
        			
        	def update(self, dt):
        		
        
        class GO(SpriteNode):
        	def __init__(self, texture='clear.png', name='', hidden=False, *args, **kwargs):
        		self.texture=Texture(texture)
        		self.name=name
        		SpriteNode.__init__(self, texture=self.texture, *args, **kwargs)
        		self._hidden=hidden
        		GameController.nodes.append(self)
        		EventBox(controller=GameController, parent=self.scene, target=self)
        	@property
        	def hidden(self):
        		return self._hidden
        		
        	@hidden.setter
        	def hidden(self, boolean):
        		self._hidden = boolean
        		if self._hidden:
        			self.alpha = 1.0
        		else:
        			self.alpha = 0.0
        	
        	def select(self):
        		pass
        	
        	def deselect(self):
        		pass
        		
        
        
        class BaseSkillNode(GO):
        	def __init__(self, skill, refItems, *args, **kwargs):
        		self.skill=skill
        		self.refItems=refItems
        		self.maxItems=3
        		self.items=list([])
        		self.refill_timer=30
        		self.refill_t=0.0
        		self.travel_timer=120
        		self.skill_level_req=0
        		self.main_level_req=0
        		self.equipment_req=None
        		self.has_items_texture=None
        		self.empty_texture=None
        		self.items_full_texture=None
        		self.gameObjects=[]
        		self.anim_present=None
        		self.anim_idle=None
        		self.anim_move=None
        		self.anim_gathering=None
        		self.anim_gather_failed=None
        		self.anim_gather_success=None
        		self.anim_dismissed=None
        		
        		GO.__init__(self, *args, **kwargs)
        		
        		
        	def Dismiss(self):
         		pass
        	def Present(self):
        		pass
        	def AddItem(self):
        		if len(self.items) == 0:
        			pass
        		print('Added Item')
        		
        	def update(self, dt):
        		if self.refill_timer != None:
        			self.refill_t += dt
        			if self.refill_t >= self.refill_timer:
        				self.AddItem()
        				self.refill_t = 0
        		if self.travel_timer > 0:
        			self.travel_timer -= dt
        			if self.travel_timer <= 0:
        				self.remove_all_actions()
        				self.run_action(self.anim_move())
        
        class FishingSpotBrush(BaseSkillNode):
        	def __init__(self, caller, skill=Skills.Fishing, refItems=[], *args, **kwargs):
        		BaseSkillNode.__init__(self,
        			skill = skill, 
        			refItems = refItems,
        			parent = caller,
        			name = 'Fishing Spot',
        			*args, **kwargs)
        			
        		self.anim_idle = Animations.Fishing_Spot_Idle
        		self.anim_move = Animations.Fishing_Spot_Move
        		self.anim_dismissed = Animations.Fishing_Spot_Dismissed
        		
        		self.gameObjects.append(SpriteNode(
        			texture = Texture('fishing-spot-idle.png'),
        			parent = self, 
        			color = '#ffd1d1'))
        			
        		self.gameObjects.append(SpriteNode(
        			texture = Texture('fishing-spot-idle.png'),
        			parent = self,
        			color = '#f3faff'))
        			
        		for go in self.gameObjects:
        			self.anim_idle(go)
        
        class main(Scene):
        	def setup(self):		
        		self.map=Desert(parent=self)
        		self.UIPlayer=PlayerSprite(self)
        		self.dir=0
        		Pointer(self)
        		self.FootSpeed=40
        		GameController.main=self
        		self.selected=None
        		
        		self.hud_test=Text(
        			pos=Point(self.size[0]/2, self.size[1]),
        			title=f'Focus',
        			text='None..',
        			parent=self)
        		
        	def update_selected(self, node):
        		node.add_child(
        			SpriteNode(
        				Texture('spc:Fire15'),
        				position=node.position))
        		if self.selected != None:
        			self.selected.deselect()
        			self.selected=None
        		self.selected = node
        		node.select()
        		self.hud_test.update_text(f'{node.name}')
        	
        	def did_change_size(self):
        		pass
        		
        	def did_evaluate_actions(self):
        		pass
        		
        	def update(self):
        		GameController.update(self.dt)
        		self.map.update(self, self.dt)
        		
        	def move(self, target):
        		loc=target
        		loc=Point((loc[0]-self.size[0]/2)*-1, (loc[1]-self.size[1]/2)*-1)
        		dur=Dist(self.UIPlayer.position, target)
        		self.map.run_action(a.repeat(a.move_by(loc[0]*self.FootSpeed*self.dt, loc[1]*self.FootSpeed*self.dt, 1), -1), 'pMoving')
        		
        	def touch_began(self, touch):
        		self.move(touch.location)
        		GameController.touch_began(touch)
        		self.UIPlayer.rotation=LookAt(self.UIPlayer.position, touch.location)
        		
        	def touch_moved(self, touch):
        		self.move(touch.location)
        		GameController.touch_moved(touch)
        		self.UIPlayer.rotation=LookAt(self.UIPlayer.position, touch.location)
        		
        	def touch_ended(self, touch):
        		GameController.touch_ended(touch)
        		self.map.run_action(a.move_by(0, 0, 0.1), 'pMoving')
        		
        if __name__=='__main__':
        	run(main(), show_fps=True)
        
        
        

        I believe that is everything that would be used with pond for now. Any Ideas?

        .

        1 Reply Last reply Reply Quote 0
        • JonB
          JonB last edited by

          Can you install @dgelessus 's faulthandler, then reproduce the crash? That will show the full stacktrace at least.

          Which code commented out fixes the crash?

          I have seen some strange unrecognized selectors when something gets totally borked, maybe some memory got overwritten.

          stephen 1 Reply Last reply Reply Quote 0
          • stephen
            stephen @JonB last edited by

            @JonB said:

            Can you install @dgelessus 's faulthandler, then reproduce the crash? That will show the full stacktrace at least.

            Which code commented out fixes the crash?

            I have seen some strange unrecognized selectors when something gets totally borked, maybe some memory got overwritten.

            sorry for the weird commenting lol i just coppied from script

            yea i will give FaultHandler a try Thank You!

            
            ###############BEGIN DEBUG BLOCK###############
            #FIXME: TESTING..
            ##class Pond(SpriteNode):
            ##	def __init__(self, p, *args, **kwargs):
            ##		self.texture = Texture('./desert/desert-pond-top.png')
            ##		self.position=Point(200, 60)
            ##		SpriteNode.__init__(self,
            ##			texture=self.texture,
            ##			position=self.position,
            ##			parent=p, *args, **kwargs)
            ##		self.fishingSpots=[
            ##			Point(-350, 100),
            ##			Point(50, -200),
            ##			Point(50, 225),
            ##			Point(325, 100)]
            ##		self.fishingNodes=[]
            ##
            ##			FishingSpotBrush(self, [], position=Point(0, 0)),#self.fishingSpots[0]),
            ##			FishingSpotBrush(self, [], position=Point(0, 0))]#self.fishingSpots[1])]
            ##		for brush in self.fishingNodes:
            ##			import random
            ##			x, y=random.choice(self.fishingSpots)
            ##			brush.run_action(Action.move_to(x, y, 5))
            ##
            ##
            ##			
            ##		self.Animate()
            ##	def Animate(self):
            ##		scale = move = alpha=[]
            ##		r = rx = ry = 0
            ##		for x in range(100):
            ##			r=random.random()
            ##			inRange = 0.80 < r < 1
            ##			if inRange:
            ##				scale.append(a.scale_to(r+.10, 5, TIMING_SINODIAL))
            ##				alpha.append(a.fade_to(r-.10, 5, TIMING_SINODIAL))
            ##			rx, ry=random.randrange(5, 30), random.randrange(5, 10)
            ##			move.append(a.move_by(rx, ry, 5, TIMING_SINODIAL))
            ##			move.append(a.move_by(-rx, -ry, 5, TIMING_SINODIAL))
            ##		self.run_action(
            ##			a.repeat(
            ##				a.group(
            ##					a.sequence(scale),
            ##					a.sequence(move)), -1))
            ##
            ##class DevMapDesert(SpriteNode):
            ##	def __init__(self, p, *args, **kwargs):
            ##		self.texture = Texture('./desert/desert-testing.png')
            ##				self.size=Size(4096, 4096)
            ##		SpriteNode.__init__(self,
            ##			texture=self.texture,
            ##			size=self.size,
            ##			parent=p, *args, **kwargs)
            ##				self.pondWater=Pond(self)
            ##			def update(self, dt):
            ##		pass
            ##		
            ###############END DEBUG BLOCK###############
            
            
            1 Reply Last reply Reply Quote 0
            • JonB
              JonB last edited by

              Try commenting out the self.Animate. I wonder if the repeat forever could be a problem, say if there was a memory leak somewhere.

              stephen 1 Reply Last reply Reply Quote 0
              • stephen
                stephen @JonB last edited by

                @JonB Good Idea!

                1 Reply Last reply Reply Quote 0
                • stephen
                  stephen last edited by

                  @JonB i cannot seem to find FaultHandler

                  cvp 1 Reply Last reply Reply Quote 0
                  • stephen
                    stephen last edited by stephen

                    @JonB @mikael I believe i found the one issue.

                    
                            r1= SpriteNode(
                    			Texture(ui.Image.named('./assets/player-ring1.png')),
                    			position=p.size/2,
                    			scale=0.5,
                    			speed=2,
                    			alpha=0,
                    			parent=main)
                    		r2= SpriteNode(
                    			Texture(ui.Image.named('./assets/player-ring2.png')),
                    			position=p.size/2,
                    			scale=0.5,
                    			speed=2,
                    			alpha=0,
                    			parent=main)
                    
                    

                    i think Texture(ui.Image.named('./assets/player-ring1.png')), is whats crashing but i agree on the memory leak. so im going to go over every object and see if i can find what hanging up..

                    1 Reply Last reply Reply Quote 0
                    • cvp
                      cvp @stephen last edited by

                      @stephen said:

                      cannot seem to find FaultHandler

                      https://github.com/dgelessus/pythonista_startup

                      1 Reply Last reply Reply Quote 1
                      • stephen
                        stephen last edited by stephen

                        @cvp ... guess who looked right at it earlier and didmt see it... πŸ‘‰πŸΌπŸ€¦πŸ»β€β™‚οΈ

                        1 Reply Last reply Reply Quote 0
                        • njm
                          njm last edited by

                          @stephen said:

                          for brush in self.fishingNodes:
                          from random import choice
                          x, y = choice(self.fishingSpots)
                          brush.run_action(Action.move_to(x, y, 5))

                          self.Animate()
                                  def Animate(self):
                              scale = move = alpha=[]
                              r = rx = ry = 0
                              for x in range(100):
                          

                          @stephen, I'm confused by the indentation and code sequence in this region of class Pond. Maybe the problem is here?

                          stephen 1 Reply Last reply Reply Quote 0
                          • stephen
                            stephen @njm last edited by stephen

                            @njm i see lol this was a section that was commented out by another script i been working on and the uncomment function is still buggy. normally that code is like the following. otherwise the script wouldnt run at all

                            
                                for brush in self.fishingNodes:
                            		from random import choice
                            		x, y = choice(self.fishingSpots)
                            		brush.run_action(Action.move_to(x, y, 5))
                            
                            	self.Animate()
                            	
                            def Animate(self):
                                scale = move = alpha=[]
                                r = rx = ry = 0
                                for x in range(100):
                            
                            1 Reply Last reply Reply Quote 0
                            • stephen
                              stephen last edited by

                              @JonB @mikael @cvp @njm turned out he ui.Image calls inside Texture combined with two corrupted images was the problem. when i removed the ui.Image calls i still crashed but with no stack report at all then i somehow came across two png files the were 101b in size instead of the 1.1MB lol no more crashes. thanks for all the help everyone!

                              cvp 1 Reply Last reply Reply Quote 0
                              • cvp
                                cvp @stephen last edited by

                                @stephen πŸ‘

                                1 Reply Last reply Reply Quote 1
                                • First post
                                  Last post
                                Powered by NodeBB Forums | Contributors