Jan 15 release: AttributeError: 'Edict' object has no attribute 'get_property_int'

Please post any questions about developing your plugin here. Please use the search function before posting!
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Jan 15 release: AttributeError: 'Edict' object has no attribute 'get_property_int'

Postby BackRaw » Sat Jan 17, 2015 6:33 pm

Hi everyone,

I'm getting this strange error and I don't know where it's coming from. I'm updating my FlashFun.SP script for the January 15 release and the entity changes.

The error:

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File '../addons/source-python/packages/source-python/plugins/manager.py', line 78, in __missing__
    instance.globals['load']()
  File '../addons/source-python/plugins/flashfunsp/flashfunsp.py', line 253, in load
    for player in map(Player, playeriter_alive):
  File '../addons/source-python/packages/source-python/filters/iterator.py', line 39, in __iter__
    if not self._is_valid(item):
  File '../addons/source-python/packages/source-python/filters/iterator.py', line 77, in _is_valid
    if not self.manager._filters[filter_name](item):
  File '../addons/source-python/packages/source-python/filters/players.py', line 113, in <lambda>
    playerinfo).get_property_int('pl.deadflag'))
 
AttributeError: 'Edict' object has no attribute 'get_property_int'


players.py
flashfunsp.py lines to cause the error:

Syntax: Select all

from filters.players import PlayerIter

from flashfunsp.config import config_manager
from flashfunsp.players import Player

# ...

playeriter_alive = PlayerIter(is_filters="alive")

# ...

def prepare(player):
"""
Prepares the player for the battle.
"""

# set health, armor and cash attributes
player.health = config_manager["health"]
player.armor = 0
player.cash = 0

# remove their weapons
player.strip()

# is spawnprotection enabled?
seconds = config_manager["spawnprotection"]

# if yes, start the spawnprotection loops
if seconds:
player.god = True
player.spawnprotection_loop(seconds)

# ...

def load():
# prepare each alive player
for player in map(Player, playeriter_alive):
prepare(player)


Can you help me figure this out? :)
My Github repositories:

Source.Python: https://github.com/backraw
User avatar
satoon101
Project Leader
Posts: 2703
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sat Jan 17, 2015 6:37 pm

That is an error on our end related to the entities updates. We will get that fixed asap and I will post a new release tonight.
Image
User avatar
BackRaw
Senior Member
Posts: 537
Joined: Sun Jul 15, 2012 1:46 am
Location: Germany
Contact:

Postby BackRaw » Sat Jan 17, 2015 6:51 pm

satoon101 wrote:That is an error on our end related to the entities updates. We will get that fixed asap and I will post a new release tonight.


Good to know thanks :)
My Github repositories:

Source.Python: https://github.com/backraw
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Postby arawra » Sun Jan 18, 2015 12:29 am

After the update, I'm not sure if players.entity or entities.entity has a health attribute anymore?

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File '..\addons\source-python\packages\source-python\events\listener.py', line 90, in fire_game_event
    callback(game_event)
  File '..\addons\source-python\plugins\dnd\dnd.py', line 237, in player_spawn
    spawnee.health += 10
  File '..\addons\source-python\packages\source-python\entities\entity.py', line 83, in __getattr__
    raise AttributeError('Attribute '{0}' not found'.format(attr))

AttributeError: Attribute 'health' not found


Syntax: Select all

@Event
def player_spawn(game_event):
global timers
spawnee_userid = game_event.get_int('userid')
spawnee = dndPlayerDictionary[spawnee_userid]
tell(spawnee.playerinfo, 'You are playing a %s %s %s'%(spawnee.getRace(), spawnee.getLevel(), spawnee.getClass()))
spawnee.reset()

#colorDelay = TickRepeat(spawnee.set_color, [255,255,255,230])
#colorDelay.start(3,1)

#remember to call: globals()[race OR class].spawn()
if spawnee.getRace() == 'Dwarf':
spawnee.maxhp += 10
tell(spawnee.playerinfo, spawnee.maxhp)
#spawnee.health = spawnee.maxhp
spawnee.health += 10
spawnee.maxspeed -= .1
spawnee.speed = spawnee.maxspeed
tell(spawnee.playerinfo, 'You have an extra 10 HP for being a hardy Dwarf, but are slow and unfriendly')

if spawnee.getRace() == 'Elf':
pass


This was working before the update, and the player's health was changed. Do we need to actually update the property m_iHealth again?
User avatar
satoon101
Project Leader
Posts: 2703
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Jan 18, 2015 1:00 am

Did you update your ../addons/source-python/data/source-python/ directory? There were changes to its structure that would cause that error to occur if you didn't update it.
Image
arawra
Senior Member
Posts: 190
Joined: Fri Jun 21, 2013 6:51 am

Postby arawra » Sun Jan 18, 2015 1:35 am

I thought I overwrote everything, will have to double check.
User avatar
satoon101
Project Leader
Posts: 2703
Joined: Sat Jul 07, 2012 1:59 am

Postby satoon101 » Sun Jan 18, 2015 2:34 am

As for the main purpose of this topic, I have updated filters.players. I will post a new build shortly.
Image

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 129 guests