[sugar] AttributeErrors

Marco Pesenti Gritti mpg
Tue Sep 5 18:47:06 EDT 2006


Erik Blankinship wrote:
> Below is a simple sugar app and the log it creates when run on today's 
> build.
>
> There appears to be a problem with:
> [1] AttributeError: 'crop' object has no attribute '_activity_type'
> and
> [2] AttributeError: 'NoneType' object has no attribute 'get_name'
>
> If I remove the Presence calls (just the gtk button), I don't get 
> these errors.  Any ideas?  Thanks.
>
>
> import gtk
>
> from sugar.activity.Activity import Activity
> from sugar.presence import PresenceService
> import logging
>
> class crop(Activity):
>     def __init__(self):
>         Activity.__init__(self)
>
>         button = gtk.Button('Why am I busted?')
>         self.add(button)
>         button.show()
>
>         self._ps = PresenceService.get_instance()
>         me = self._ps.get_owner()
>         name = me.get_name()
>         logging.info("I am %s" % name)
>         activities = self._ps.get_activities()
>         for act in activities:
>             logging.info("Activity: %s" % act.get_id())

The presence service owner is initialized asynchronously, so it's 
usually None when then presence service has just been instantiated. Dan 
should know the details...

An alternative way to get the nick name is to use sugar.env.get_nick_name()

Marco


More information about the Sugar-devel mailing list