AttributeErrors

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

AttributeErrors

Erik Blankinship
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())


# # #

Traceback (most recent call last):
  File
"/root/sugars/09-05/sugar-jhbuild/build/share/sugar/shell/frame/BottomPanel.py",
line 53, in __activity_clicked_cb
    self._shell.start_activity(icon.get_bundle_id())
  File "/root/sugars/09-05/sugar-jhbuild/build/share/sugar/shell/Shell.py",
line 163, in start_activity
    activity = ActivityFactory.create(activity_type)
  File
"/root/sugars/09-05/sugar-jhbuild/build/lib/python2.4/site-packages/sugar/activity/ActivityFactory.py",
line 56, in create
    xid = factory.create()
  File "/usr/lib/python2.4/site-packages/dbus/proxies.py", line 25, in
__call__
    ret = self._proxy_method (*args, **keywords)
  File "/usr/lib/python2.4/site-packages/dbus/proxies.py", line 102, in
__call__
    reply_message = self._connection.send_with_reply_and_block(message,
timeout)
  File "dbus_bindings.pyx", line 455, in
dbus_bindings.Connection.send_with_reply_and_block
DBusException: Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/dbus/service.py", line 304, in
_message_cb
    retval = candidate_method(self, *args, **keywords)
  File
"/root/sugars/09-05/sugar-jhbuild/build/lib/python2.4/site-packages/sugar/activity/ActivityFactory.py",
line 42, in create
    activity = self._class()
  File
"/root/sugars/09-05/sugar-jhbuild/build/share/sugar/activities/crop/crop.py",
line 19, in __init__
    name = me.get_name()
AttributeError: 'NoneType' object has no attribute 'get_name'

Traceback (most recent call last):
  File "/root/sugars/09-05/sugar-jhbuild/build/share/sugar/shell/Shell.py",
line 107, in __window_opened_cb
    host = ActivityHost(self, window)
  File
"/root/sugars/09-05/sugar-jhbuild/build/share/sugar/shell/ActivityHost.py",
line 24, in __init__
    self._type = self._activity.get_type()
  File "/usr/lib/python2.4/site-packages/dbus/proxies.py", line 102, in
__call__
    reply_message = self._connection.send_with_reply_and_block(message,
timeout)
  File "dbus_bindings.pyx", line 455, in
dbus_bindings.Connection.send_with_reply_and_block
DBusException: Traceback (most recent call last):
  File "/usr/lib/python2.4/site-packages/dbus/service.py", line 304, in
_message_cb
    retval = candidate_method(self, *args, **keywords)
  File
"/root/sugars/09-05/sugar-jhbuild/build/lib/python2.4/site-packages/sugar/activity/Activity.py",
line 52, in get_type
    return self._activity.get_type()
  File
"/root/sugars/09-05/sugar-jhbuild/build/lib/python2.4/site-packages/sugar/activity/Activity.py",
line 97, in get_type
    return self._activity_type
AttributeError: 'crop' object has no attribute '_activity_type'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.laptop.org/pipermail/sugar/attachments/20060905/04be073d/attachment-0001.html
Reply | Threaded
Open this post in threaded view
|

AttributeErrors

Marco Pesenti Gritti
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
Reply | Threaded
Open this post in threaded view
|

AttributeErrors

Dan Williams-4
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

Reply | Threaded
Open this post in threaded view
|

AttributeErrors

Dan Williams-4
On Wed, 2006-09-06 at 09:34 -0400, Dan Williams wrote:

> 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.

This should be fixed now; but all you really have access to immediately
is the owner's name until the first services provided by the owner (ie,
the chat and presence ones) are resolved.  Eventually you'll likely have
access to the owner's color and such before service resolution too.  So
you shouldn't need to import and/or init sugar.env.

Dan

> Dan
>
> > An alternative way to get the nick name is to use sugar.env.get_nick_name()
> >
> > Marco
>
> _______________________________________________
> Sugar mailing list
> [hidden email]
> http://mailman.laptop.org/mailman/listinfo/sugar

Reply | Threaded
Open this post in threaded view
|

AttributeErrors

Erik Blankinship
Okay - sounds good.  Is there an api listing of the calls available (or soon
to be available)?  Or are they listed somewhere in the sugar source code?


On 9/6/06, Dan Williams <[hidden email]> wrote:

>
> On Wed, 2006-09-06 at 09:34 -0400, Dan Williams wrote:
> > 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.
>
> This should be fixed now; but all you really have access to immediately
> is the owner's name until the first services provided by the owner (ie,
> the chat and presence ones) are resolved.  Eventually you'll likely have
> access to the owner's color and such before service resolution too.  So
> you shouldn't need to import and/or init sugar.env.
>
> Dan
>
> > Dan
> >
> > > An alternative way to get the nick name is to use
> sugar.env.get_nick_name()
> > >
> > > Marco
> >
> > _______________________________________________
> > Sugar mailing list
> > [hidden email]
> > http://mailman.laptop.org/mailman/listinfo/sugar
>
> _______________________________________________
> Sugar mailing list
> [hidden email]
> http://mailman.laptop.org/mailman/listinfo/sugar
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.laptop.org/pipermail/sugar/attachments/20060906/4bae80c6/attachment-0001.html
Reply | Threaded
Open this post in threaded view
|

AttributeErrors

Dan Williams-4
On Wed, 2006-09-06 at 11:58 -0400, Erik Blankinship wrote:
> Okay - sounds good.  Is there an api listing of the calls available
> (or soon to be available)?  Or are they listed somewhere in the sugar
> source code?

http://wiki.laptop.org/go/Presence_Service_DBus_API

May be slightly out of date; if you notice any inaccuracies please let
the list know.

Dan

>
> On 9/6/06, Dan Williams <[hidden email]> wrote:
>         On Wed, 2006-09-06 at 09:34 -0400, Dan Williams wrote:
>         > 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.
>        
>         This should be fixed now; but all you really have access to
>         immediately
>         is the owner's name until the first services provided by the
>         owner (ie,
>         the chat and presence ones) are resolved.  Eventually you'll
>         likely have
>         access to the owner's color and such before service resolution
>         too.  So
>         you shouldn't need to import and/or init sugar.env.
>        
>         Dan
>        
>         > Dan
>         >
>         > > An alternative way to get the nick name is to use
>         sugar.env.get_nick_name()
>         > >
>         > > Marco
>         >
>         > _______________________________________________
>         > Sugar mailing list
>         > [hidden email]
>         > http://mailman.laptop.org/mailman/listinfo/sugar
>        
>         _______________________________________________
>         Sugar mailing list
>         [hidden email]
>         http://mailman.laptop.org/mailman/listinfo/sugar
>