god_player.db._playable_characters has no attribute 'append'

26 views
Skip to first unread message

Marcus Bell

unread,
Feb 3, 2015, 10:14:34 AM2/3/15
to eve...@googlegroups.com
Whenever I start Evennia it blows up with the following traceback.

 Resuming initial setup from step 1.
 
Creating objects (Player #1 and Limbo room) ...
#1
Unhandled Error
Traceback (most recent call last):
 
File "C:\Python27\twisted\application\app.py", line 642, in run
    runApp
(config)
 
File "C:\Python27\twisted\scripts\twistd.py", line 23, in runApp
    _SomeApplicationRunner
(config).run()
 
File "C:\Python27\twisted\application\app.py", line 376, in run
   
self.application = self.createOrGetApplication()
 
File "C:\Python27\twisted\application\app.py", line 441, in createOrGetApplica
tion
    application
= getApplication(self.config, passphrase)
--- <exception caught here> ---
 
File "C:\Python27\twisted\application\app.py", line 452, in getApplication
    application
= service.loadApplication(filename, style, passphrase)
 
File "C:\Python27\twisted\application\service.py", line 405, in loadApplication
    application
= sob.loadValueFromFile(filename, 'application', passphrase)
 
File "C:\Python27\twisted\persisted\sob.py", line 210, in loadValueFromFile
   
exec fileObj in d, d
 
File "C:\mushdev\evennia\src\server/server.py", line 433, in <module>
    EVENNIA
= Evennia(application)
 
File "C:\mushdev\evennia\src\server/server.py", line 118, in __init__
   
self.run_initial_setup()
 
File "C:\mushdev\evennia\src\server/server.py", line 221, in run_initial_setup


    initial_setup
.handle_setup(int(last_initial_setup_step))
 
File "C:\mushdev\evennia\src\server\initial_setup.py", line 250, in handle_setup
    setup_func
()
 
File "C:\mushdev\evennia\src\server\initial_setup.py", line 82, in create_objects
    god_player
.db._playable_characters.append(god_character)
exceptions
.AttributeError: 'NoneType' object has no attribute 'append'
Failed to load application: 'NoneType' object has no attribute 'append'


I can tell it is database related but don't know why it started out of the blue. I have been working with the same version of Evennia for weeks & have been careful not to make any changes outside of game.gamesrc. Checked modify dates/times, none of the source files have changed. I was able to bypass it for now by pulling an older copy of evennia.db3 from backup - is that going to cause problems later?

Griatch Art

unread,
Feb 3, 2015, 10:57:15 AM2/3/15
to eve...@googlegroups.com
You seem to have set the _playable_characters Attribute on your Player #1 to None. The _playable_characters Attribute should normally be a list (the error tells us that the system looks for the .append attribute, which is a list method, but cannot find it since it is looking at None and not a list).

You should also not be running initial_setup again once you did it once, so this suggests you are starting with a fresh database, and that you overloaded the Player's typeclass setup (where the _playable_characters Attribute is set) without setting it yourself. Use super() in your overloading at_player_creation() to get the parent functionality as well.

Anyway, the situation (however it emerged) is easily fixed:

python manage.py shell
>>> import ev
>>> god_player = ev.search_player(id=1)
>>> god_character = ev.search_object(id=1)
>>> god_player.db._playable_characters = [god_character]


That should fix things for now. But you should try to figure out why the Attribute was set to None in the first place.
.
Griatch

Marcus Bell

unread,
Feb 3, 2015, 12:19:03 PM2/3/15
to eve...@googlegroups.com
That code doesn't work because it thinks god_player is a list without a db attribute.

You correctly deduced two things: I am trying to use new database and overriding at_player_creation in my Player class, like so:
(settings.py)
BASE_PLAYER_TYPECLASS = "game.gamesrc.objects.player.Player"


from ev import Player as DefaultPlayer                
class Player(DefaultPlayer):

def at_player_creation(self):
    super(DefaultPlayer, self).at_player_creation()

it complains 'super' object has no attribute 'at_player_creation'... which makes no sense because it is already in that function in my derived class when it blows up. So it seems like the correct function is being invoked by evennia framework yet python doesn't recognize it as a derived class. (my interpretation)



--
--
You received this message because you are subscribed to the "Evennia" MU* server mailing list.
To post to this group, send email to eve...@googlegroups.com (or use the web interface).
To unsubscribe from this group, send email to evennia+u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/evennia?hl=en

---
You received this message because you are subscribed to a topic in the Google Groups "Evennia" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/evennia/t_Nvd7Lpw4Q/unsubscribe.
To unsubscribe from this group and all its topics, send an email to evennia+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Griatch Art

unread,
Feb 3, 2015, 1:11:27 PM2/3/15
to eve...@googlegroups.com
Ah, right, sorry. The ev.search_objects() and ev.search_players() return lists, so you need to do [0] on the results to get the actual objects, like so:

python manage.py shell
>>> import ev
>>> god_player = ev.search_player(id=1)[0]
>>> god_character = ev.search_object(id=1)[0]
>>> god_player.db._playable_characters = [god_character]


Anyway, the error you get with super() is because you are using the wrong base class. You are using DefaultPlayer as the call to super(), which means that you are actually trying to call the creation hook on the parent of DefaultPlayer. That has no such hook (it's first defined in DefaultPlayer). What you want is:

super(Player, self).at_player_creation()

which will call the parent of Player (i.e. DefaultPlayer), which holds the default implementation of at_player_creation().
.
Griatch

Marcus Bell

unread,
Feb 4, 2015, 4:03:29 AM2/4/15
to eve...@googlegroups.com
Ok, yeah, deriving another class from Player fixed it. 
Reply all
Reply to author
Forward
0 new messages