[Sugar-devel] Fwd: Problem developing app

James Simmons nicestep at gmail.com
Wed Dec 8 14:41:59 EST 2010


Rodrigo,

If you look at my book example on using PyGame you'll see that I
recommend copying the sugargame directory into the root directory of
the Activity:

http://en.flossmanuals.net/ActivitiesGuideSugar/ActivitiesUsingPyGame

You are also doing this.  That's why your import for sugargame is
working, not because you're adding anything to the Python path.  You
might try the same thing with your version of pygame.  I don't know if
that will fix anything, but it's worth trying.  Have a look at my
simple pygame example too, and see how it differs from yours.

James Simmons


On Wed, Dec 8, 2010 at 12:35 PM, Rodrigo <rodripf at gmail.com> wrote:
> The relative paths work fine now with the sugar-launch command, I just
> wasn't changing the current directory to the activity directory ¬¬.
>
> I am not receiving any error from the sugar-launch in command line now, but
> the main problem persists.
> I've uploaded a few changes to the git.
> --
> Rodrigo Pérez Fulloni - http://www.intermeddia.com
>
>
> On Wed, Dec 8, 2010 at 12:30 PM, Rodrigo <rodripf at gmail.com> wrote:
>>>
>>> Instead of class = you might try this:
>>>
>>> exec = sugar-activity hMouse.hMouse
>>
>> I changed it. I don't know if works yet.
>>>
>>> These should not be necessary. Everything in your Activity should be
>>>
>>> either part of the normal Python path or contained in the XO bundle.
>>>
>>> You're also hard coding paths that may not always exist. If I test
>>>
>>> your Activity using sugar-emulator, for instance, I won't have those
>>>
>>> directories.
>>
>> I've tried with relative paths, but this way I can't import the
>> pygame.camera module... "ImportError: No module named camera". I don't know
>> why... but it doesn't work. As you may see, I'm using my own version of
>> pygame, because the XO has only the 1.8 version, but I need the camera
>> module in the 1.9 version.
>> Apparently there is a problem with the imports, because sugargame package
>> import is working fine. I guess that when I do the "import pygame" it search
>> for the pygame in the XO instead the pygame in my activity, so when it look
>> for pygame.camea it doesn't exists. Even if I do sys.paht.insert(0, "lib")
>> the problem persist (lib is the folder where is my pygame 1.9).
>>>
>>> It looks like your Activity interacts with the hardware in unusual
>>>
>>> ways. This may not be allowed by Rainbow, which is a kind of sandbox
>>>
>>> used by Sugar.
>>
>> In effect, I control the camera with PyGame 1.9 and control the mouse
>> cursor via XLib... but I think this is the usual (and unique) way... do you
>> have another idea to do this?
>> Thanks!
>> --
>> Rodrigo Pérez Fulloni
>>
>
>
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
>
>


More information about the Sugar-devel mailing list