[Sugar-devel] PyGame can be run only once assertion error

Alan Jhonn Aguiar Schwyn alanjas at hotmail.com
Fri Sep 27 04:19:04 EDT 2013


I think that is not "terrific" problem.The problem must be documented, it's a easy to solve inconvenient.In the code, sugargames/canvas.py there are this:
# Preinitialize Pygame with the X window ID. assert pygame.display.get_init() == False, "Pygame must not be initialized before calling PygameCanvas.run_pygame."

> Date: Fri, 27 Sep 2013 17:14:58 +1000
> From: quozl at laptop.org
> To: alanjas at hotmail.com
> CC: sugar-devel at lists.sugarlabs.org; laurent.bernabe at gmail.com
> Subject: Re: [Sugar-devel] PyGame can be run only once assertion error
> 
> Could this be fixed in SugarGames in future?
> 
> (Not an invitation to discuss deprecation in favour of alternate
> technologies; clearly it is in use, why can't we fix it?)
> 
> On Fri, Sep 27, 2013 at 04:07:11AM -0300, Alan Jhonn Aguiar Schwyn wrote:
> > There are not problem with call "pygame.init" all times that you want (see the
> > documentation).
> > The problem is call outside of self._pygamecanvas.run_pygame function.
> > It's one thing of SugarGames.
> > 
> > ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> > Date: Fri, 27 Sep 2013 09:03:25 +0200
> > Subject: Re: [Sugar-devel] PyGame can be run only once assertion error
> > From: laurent.bernabe at gmail.com
> > To: alanjas at hotmail.com
> > CC: sugar-devel at lists.sugarlabs.org
> > 
> > Thank you very much.
> > 
> > In fact I had already solved the problem and commited when I read your message
> > : my idea was the same than yours, but I've done it with a "lazy
> > initialisation", thanks to a flag self._initialized (boolean).
> > 
> > Thanks :)
> > 
> > 
> > 2013/9/26 Alan Jhonn Aguiar Schwyn <alanjas at hotmail.com>
> > 
> >     A patch worth more than 1000 words..
> > 
> >     In the patch I show "the idea" behind the problem. You can move all code
> >     that not needs pygame to the __init__ of the Game class.
> > 
> >     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> >     From: alanjas at hotmail.com
> >     To: laurent.bernabe at gmail.com; sugar-devel at lists.sugarlabs.org
> >     Date: Thu, 26 Sep 2013 15:01:13 -0300
> >     Subject: Re: [Sugar-devel] PyGame can be run only once assertion error
> > 
> >     You can't call pygame.init in the game creation,
> >     not worry if you put all code on self._act.show_menu
> > 
> >     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> >     Date: Thu, 26 Sep 2013 17:01:04 +0000
> >     From: laurent.bernabe at gmail.com
> >     To: sugar-devel at lists.sugarlabs.org
> >     Subject: [Sugar-devel] PyGame can be run only once assertion error
> > 
> >     Hello, everyone,
> > 
> >     In my project HitTheBalls, which I've just commited the last modifications,
> >     I have a bug I that I don't manage to solve.
> > 
> >     If I launch the game without sugar, however, it runs fine.
> >     Also I modified the activity.py in order to fit my main_game module
> >     modifications. Maybe that the reason why I have this behaviour (the
> >     activity log is not very verbose in my case).
> > 
> >     So how can I solve the problem ?
> > 
> >     This is the activity log :
> > 
> >     ________________________________________________________
> >     1380214070.631923 WARNING root: No Gtk.AccelGroup in the top level window.
> >     Traceback (most recent call last):
> >       File "/home/broot/sugar-build/activities/HitTheBalls.activity/sugargame/
> >     canvas.py", line 40, in _run_pygame_cb
> >         assert pygame.display.get_surface() is None, "PygameCanvas.run_pygame
> >     can only be called once."
> >     AssertionError: PygameCanvas.run_pygame can only be called once.
> >     1380214073.021442 WARNING root: No Gtk.AccelGroup in the top level window.
> >     Exited with status 0, pid 9045 data (None, <open file '<fdopen>', mode 'w'
> >     at 0x1a299c0>, dbus.ByteArray('e2c07f313236150806506c5508b5a987bf6d2b4d',
> >     variant_level=1))
> >     _________________________________________________________________
> > 
> >     Regards
> > 
> >     _______________________________________________ Sugar-devel mailing list
> >     Sugar-devel at lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/
> >     sugar-devel
> > 
> >     _______________________________________________ Sugar-devel mailing list
> >     Sugar-devel at lists.sugarlabs.org http://lists.sugarlabs.org/listinfo/
> >     sugar-devel
> > 
> >     _______________________________________________
> >     Sugar-devel mailing list
> >     Sugar-devel at lists.sugarlabs.org
> >     http://lists.sugarlabs.org/listinfo/sugar-devel
> > 
> > 
> > 
> 
> > _______________________________________________
> > Sugar-devel mailing list
> > Sugar-devel at lists.sugarlabs.org
> > http://lists.sugarlabs.org/listinfo/sugar-devel
> 
> 
> -- 
> James Cameron
> http://quozl.linux.org.au/
> _______________________________________________
> Sugar-devel mailing list
> Sugar-devel at lists.sugarlabs.org
> http://lists.sugarlabs.org/listinfo/sugar-devel
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20130927/8469d386/attachment.html>


More information about the Sugar-devel mailing list