Skip to content
This repository was archived by the owner on Apr 26, 2020. It is now read-only.
This repository was archived by the owner on Apr 26, 2020. It is now read-only.

Server displays AttributeError error #2

@mzfr

Description

@mzfr

Describe the bug
When I run the server and after players start playing on my terminal in the server I can see a lot of traceback being generated. Giving the following error:

Traceback (most recent call last):
  File "data/scripts/bsGame.py", line 352, in __del__
    self.handleMessage(DieMessage())
  File "data/scripts/bsPowerup.py", line 487, in handleMessage
    if self.nodeLight.exists():

To Reproduce
Steps to reproduce the behavior:

  1. Start the server.
  2. Wait for people to join and start playing.
  3. See error

Expected behavior
There should be any traceback displayed.

Platform(please complete the following information):

  • Device: Digital ocean droplet
  • OS: Ubuntu

Additional context

if we print out all the attributes of the object we can see the following

['__class__', '__del__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_activity', '_handleMessageSanityCheck', '_powersGiven', '_startFlashing', 'autoRetain', 'delete_portal', 'exists', 'getActivity', 'getFactory', 'handleMessage', 'isAlive', 'isFinalized', 'node', 'onFinalize', 'portal', 'powerupType']

And as we can see that there is no nodeLight there, this is because inline 360 of bsPowerup.py you set self.nodeLigh to certain values but only when settings.discoLightsOnPowerUps are on. Here is the code snippet of bsPowerup.py from line 359 to 366

if settings.discoLightsOnPowerUps:
    self.nodeLight = bs.newNode('light',
                                attrs={'position': self.node.position,
                                        'color': color,
                                        'radius': 0.05,
                                        'volumeIntensityScale': 0.03})
    self.node.connectAttr('position', self.nodeLight, 'position')
    bsUtils.animateArray(self.nodeLight, 'color', 3, prefixAnim, True)

Fix

So I think the fix would be to add a simple check condition above line 486 and the complete code would look like(from line 479 to 488):

elif isinstance(msg, bs.DieMessage):
    if self.node.exists():
        if (msg.immediate):
            self.node.delete()
        else:
            curve = bs.animate(self.node, "modelScale", {0: 1, 100: 0})
            bs.gameTimer(100, self.node.delete)
    if settings.discoLightsOnPowerUps: 
		if self.nodeLight.exists():
       	 self.nodeLight.delete()

Sorry to just write everything here, if you would put the source code on this repository I would be happy to make a PR for it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions