New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Physics 35 activity crashes immediately with Pygame 2.0.1 #50
Comments
This appears to be related to d3a7117 Fedora 34 includes librsvg2 version 2.50.3 |
I manually applied the above change/patch, and now Physics crashes with:
|
Possibly a change to PyGObject or CPython internals. sugarlabs/arithmetic#7 (comment) also found that property setters were being called earlier in the more recent releases of Python. In the traceback above, the Activity active property is being changed causing Journal write before the Physics World is set up by Does this fix it? diff --git a/physics.py b/physics.py
index 300cf44..30b9f0e 100644
--- a/physics.py
+++ b/physics.py
@@ -75,6 +75,8 @@ class PhysicsGame:
def write_file(self, path):
# Saving to journal
+ if not getattr(self, world):
+ return
self.world.add.remove_mouseJoint()
additional_data = {
'trackinfo': self.trackinfo, |
@quozl, with that patch applied, the activity fails to start, with a Python error |
Might be worth testing without d3a7117 as |
Interesting. I'm using librsvg2 2.50.3 on Debian 11 (Bullseye) with HEAD, and there's no error. If I revert d3a7117 there are three errors in logs, all expected XML parse error, and some buttons are without an icon. I also don't get what @aperezbios was getting ("AttributeError: 'PhysicsGame' object has no attribute 'world'"). But I see my patch above was in error. Quotes are missing. diff --git a/physics.py b/physics.py
index 300cf44..ed43fab 100644
--- a/physics.py
+++ b/physics.py
@@ -75,6 +75,8 @@ class PhysicsGame:
def write_file(self, path):
# Saving to journal
+ if not getattr(self, 'world'):
+ return
self.world.add.remove_mouseJoint()
additional_data = {
'trackinfo': self.trackinfo, |
At the same line number? |
Here's the exact output:
|
Sorry, my mistake. Should be hasattr not getattr. Flying blind. |
😆 happens sometimes, I didn't see that either. |
@quozl, with getattr changed to hasattr, here's the log output:
|
Thanks. Does the activity work despite this sugargame keycode related problem? |
It does not. I get a black window. pygame task seems hung. |
Thanks. Can I see the start of the log? It appears to be truncated at the top. |
It's not truncated. That's the entire extent of the log. |
Interesting, thanks. |
Upon closer inspection, it's not actually crashing, but the contents of the pygame window aren't being drawn. If I move the pygame window manually, it re-draws the contents of the window |
You'll not need to move the pygame window manually as it's been set as the activity canvas, can't think of the reasons why at the moment and the log doesn't seem to tell much. |
My guess is Sugargame doesn't work properly with latest Pygame or GTK, in respect of linking the Pygame window into the GTK canvas for the activity. It would be helpful to reproduce with the Sugargame test activity. |
Agreed. |
Reproduced. Investigating. |
I ran out of time. Cause of the IndexError in I also verified physics.py and activity.py against the Sugargame test activity to make sure everything was being done right; there were a few things done wrong, but fixing them did not improve the situation; the Pygame window remains separate rather than embedded. Something not working with Gtk.Socket or SDL_WINDOWID, but don't know what. |
Regarding the Pygame window being separate. The SDL_WINDOWID feature of SDL allows the window to be reparented. The feature bypasses Pygame, using an environment variable. We use it in Sugar activities. A change in SDL 2 removed the SDL_WINDOWID feature and replaced it with an API implementation. The different way the feature is implemented requires a solution to be made inside Pygame. It is being tracked here. We might also see progress in the SDL upstream. See here for one such issue of relevance. This breaks all Sugargame activities, and any activities that embed Pygame inside GTK. A brief list of affected activities; This also breaks many other SDL based applications on Linux, so there's a good chance there may be a fix forthcoming. To find other bugs, look for SDL_WINDOWID in bug trackers. For the moment, Physics 35 requires SDL 1. We could have noticed it in December if we had tested with the latest SDL rather than waiting for Fedora to package it. |
Because this activity is currently broken, and not in a usable state, remove it from the SoaS compose until such time as it's been resolved. There's currently no fix. For further details, see sugarlabs/physics#50
The issue of pygame window not embedding correctly has been fixed in the upstream, (pygame 2.3.0 release). |
Thanks, that's great. |
Upon starting Physics 35, packaged in the Fedora 34 SoaS nightly, which uses Sugar 0.118, the following is logged, and the application exits, returning the user to the Sugar application pane. The bundled version of python3-pybox2d is 2.3.2-25
The text was updated successfully, but these errors were encountered: