[OLPC-Games] Help with porting pygame code to sugar

Mike C. Fletcher mcfletch at vrplumber.com
Sat Dec 15 09:19:45 EST 2007


Tim Wintle wrote:
> Hi,
>
> I've been trying to use the OLPCGames scripts to create a sugar runtime,
> but I can't get it to work on my emulated laptop.
> (Running qemu on Ubuntu Gutsy 64 - everything else seems to work great.)
>
> I get all the scripts fine, and everything works in (my) Linux.
>   
I'm assuming by this you mean in a sugar-jhbuild environment on your
Linux machine.
> I then scp them to the XO (I've tried direct to /usr/share/activities
> and to ~/olpc - it's not clear from the wiki where to put them)
>   
~olpc/Activities is the correct directory for activities not included in
the core image.
> Running "setup.py dev" seems to work fine, and after reboot the activity
> appears in the frame.
>
> But... I can't launch the activity.
>
> Looking in the logs I find a DBus error
> "org.freedesktop.DBus.Error.Spawn.ExecFailed: Failed to execute
> program /home/olpc/Activities/test.activity.activity/sugar-activity:No
> such file or directory"
>
> - what I don't understand is why is this .activity.activity? surely it's
> meant to be .activity?
>   
Yes, it is.  There is something wrong with the sugar bundle-builder
code.  It just blindly appends ".activity" to whatever the directory
name is where it is being run and creates a symlink in ~/Activities to
that name.  You can temporary work around it by doing the following:

  cd ~/Activities
  wget http://dev.laptop.org/~mcfletch/testactivities/videotest-1.xo
  unzip videotest-1.xo

then restart the X server (ctrl+alt+erase on a real XO, or restart the
emulator).  You can re-download and re-unzip over the current image
(remember to delete the original .xo if you are using wget).

The thing is, even though it's ugly as dirt, that *shouldn't* be your
problem.  That is, I have lots of ugly .activity.activity directories in
my Activities folder and everything still runs.
> - is sugar-activity a standard command to launch an activity in the
> active directory? (There's no file of that name so I guess so)
>   
Apparently they've now declared sugar-activity an internal api,
sugar-launch is the way to launch an activity *externally* these days,
but yes, sugar-activity should be there AFAIK, for precisely this
purpose.  It's not an incorrectly-specified module name, that gives 'No
module named blah'.  Neither is it a problem with leaving off the
argument 'A python class must be specified as first argument'.

So, maybe sugar-activity really has disappeared on your "machine"?  It
should be pretty easy to test this, look for /usr/bin/sugar-activity if
it's not there, then we'll need to pester the Sugar devs about why it
isn't and what to do with the dozens of projects using it.
> Hope someone can give some advice on how to sort this out, thanks in
> advance.
>   
Hopefully that helps somewhat.
> BTW, I am working on a project called Game Baker
> (http://code.google.com/p/game-baker/)
>
> which we hope to make into a completely graphical game development
> environment (currently pre-alpha, still requires simple python for event
> handlers, and it will be a while before we port the GUI to sugar - but
> it's a major goal).
>
> I'm trying to make an exporter to sugar packages, so games made with the
> system can run on the XO - hoping this will enable people who want to
> help but can't program to create educational games for the OLPC.
>   
That's great.  You may want to check out the olpcgames/skeleton
directory, which builds Sugar-ready OLPCGames activities from the
command-line (available in git or in the 1.3 release).  I would like to
move some of the code there (such as the build manifest script) into
OLPCGames proper so that there's less in the "boilerplate" stuff that
you check into your repository.

HTH,
Mike

-- 
________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com



More information about the Games mailing list