sugarlabs / flappy

A python-pygame Flappy Bird clone
GNU General Public License v3.0
2 stars 12 forks source link

The activity doesn't run on ubuntu's Packaged Sugar #16

Closed Dimi20cen closed 1 year ago

Dimi20cen commented 1 year ago

I get the following logs, might be an issue with the journal and might not be related to the activity.


Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 232, in maybe_handle_message
    self._handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/sugar3/datastore/datastore.py", line 61, in __datastore_created_cb
    metadata = _get_data_store().get_properties(object_id, byte_arrays=True)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
    return self._connection.call_blocking(self._named_service,
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.ValueError: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 715, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/python3/dist-packages/carquinyol/datastore.py", line 483, in get_properties
    metadata = self._metadata_store.retrieve(uid)
  File "/usr/lib/python3/dist-packages/carquinyol/metadatastore.py", line 79, in retrieve
    metadata = metadatareader.retrieve(metadata_path, properties)
ValueError: Failed to convert metadata value to bytes

(sugar-activity3:1923738): Gtk-CRITICAL **: 19:53:15.430: gtk_widget_draw: assertion '!widget->priv->alloc_needed' failed
1679334795.579602 ERROR dbus.connection: Exception in handler for D-Bus signal:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 232, in maybe_handle_message
    self._handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/sugar3/datastore/datastore.py", line 66, in __datastore_updated_cb
    metadata = _get_data_store().get_properties(object_id, byte_arrays=True)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
    return self._connection.call_blocking(self._named_service,
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.ValueError: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 715, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/python3/dist-packages/carquinyol/datastore.py", line 483, in get_properties
    metadata = self._metadata_store.retrieve(uid)
  File "/usr/lib/python3/dist-packages/carquinyol/metadatastore.py", line 79, in retrieve
    metadata = metadatareader.retrieve(metadata_path, properties)
ValueError: Failed to convert metadata value to bytes

1679334795.580413 ERROR dbus.connection: Exception in handler for D-Bus signal:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 232, in maybe_handle_message
    self._handler(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/sugar3/datastore/datastore.py", line 177, in __object_updated_cb
    properties = _get_data_store().get_properties(self._object_id,
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 141, in __call__
    return self._connection.call_blocking(self._named_service,
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 652, in call_blocking
    reply_message = self.send_message_with_reply_and_block(
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.ValueError: Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/service.py", line 715, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/python3/dist-packages/carquinyol/datastore.py", line 483, in get_properties
    metadata = self._metadata_store.retrieve(uid)
  File "/usr/lib/python3/dist-packages/carquinyol/metadatastore.py", line 79, in retrieve
    metadata = metadatareader.retrieve(metadata_path, properties)
ValueError: Failed to convert metadata value to bytes

Traceback (most recent call last):
  File "/usr/share/sugar/activities/Flappy.activity/main.py", line 174, in run
    self.load_game()
  File "/usr/share/sugar/activities/Flappy.activity/main.py", line 112, in load_game
    pipe2 = Pipe_S(
  File "/usr/share/sugar/activities/Flappy.activity/pipe.py", line 84, in __init__
    self.image = pygame.surface.Surface((91, self.height), 0)
pygame.error: Invalid resolution for Surface
Terminated by signal 9, pid 1923738 activity_id 9a14eae1b844483ebdb3b4a56f473592c1bfb78b```
quozl commented 1 year ago

Yes, that's expected. Based on the versions in your other logs you are using Ubuntu 22.04, which had Sugar Datastore 0.118, with a known problem since fixed in https://github.com/sugarlabs/sugar-datastore/commit/df4f45697d07a49cbdd2fcd0c90fbaebf3c539ab caused by an API change.

Upgrade the python3-carquinyol package to fix the ValueError, then please test again to see if you get the "Invalid resolution for Surface" error. Thanks.

(For testing, it may be possible to place the Sugar Datastore module inside the activity source tree. I've not done that for a while, but it has worked before.)

Dimi20cen commented 1 year ago

I'm now using 0.120 Sugar, the dbus error is fixed. Now I just get the following "Gtk-CRITICAL **: 18:17:41.931: gtk_widget_draw: assertion '!widget->priv->alloc_needed' failed". This issue isn't present in the live-build.

quozl commented 1 year ago

Perhaps you should assign environment variable G_DEBUG=fatal-criticals in order to capture more details of the execution context associated with the message, especially a traceback.

Does the message appear in logs of any other activities? If so, the issue may be with the toolkit, not the activity. See https://github.com/sugarlabs/log-activity/issues/21 for the same message in the Log activity.

chimosky commented 1 year ago

I'm now using 0.120 Sugar, the dbus error is fixed. Now I just get the following "Gtk-CRITICAL **: 18:17:41.931: gtk_widget_draw: assertion '!widget->priv->alloc_needed' failed". This issue isn't present in the live-build.

The activity runs now correct?

Dimi20cen commented 1 year ago

I haven't tried quozl's solution yet, but the issue is probably with my installation of sugar. I get a black page with all pygame activities I have tried. With other pygame activities I don't get an error or warning either, so yeah, it's something on my side that I need to fix, sorry for not updating sooner.

chimosky commented 1 year ago

I haven't tried quozl's solution yet, but the issue is probably with my installation of sugar. I get a black page with all pygame activities I have tried. With other pygame activities I don't get an error or warning either, so yeah, it's something on my side that I need to fix, sorry for not updating sooner.

The black page you're seeing is because of pygame1.9, update to pygame2.0 and the activities should work fine. Support for SDL_WINDOWID in pygame has been added for SDL 2, that's why you're experiencing that.

Dimi20cen commented 1 year ago

I already have pygame 2.1.2

chimosky commented 1 year ago

I think the version that fixed the issue is 2.3.0

quozl commented 1 year ago

You absolutely need to have Sugar and activities running properly before embarking on any real development, in order to avoid having to repeat your changes once you find they aren't compatible in some way.

Mine wasn't a solution, but a step toward identifying the problem.

Dimi20cen commented 1 year ago

I mainly try out and test activities with the live build and with the native builds on vm, thankfully I resolved any issues with those. But yeah I don’t use the packaged build

Dimi20cen commented 1 year ago

I think the version that fixed the issue is 2.3.0

Just used 2.3.0 and yep, now pygame activities work as expected, thank you

chimosky commented 1 year ago

Great! Closing this now.