[sugar] AttributeErrors
Dan Williams
dcbw
Wed Sep 6 09:33:11 EDT 2006
On Wed, 2006-09-06 at 00:41 +0200, Marco Pesenti Gritti wrote:
> 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...
Yeah, there should probably be a way to create at least a skeleton Owner
object, if nothing else, before the real one is found on the network.
It seems to be a problem for short-term testing while in the real
situation the PS would be initialized far before any particular activity
asks for the owner.
Dan
> 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