Skip to content
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

Port to Python 3 #787

Closed
10 tasks done
quozl opened this issue Feb 26, 2018 · 9 comments
Closed
10 tasks done

Port to Python 3 #787

quozl opened this issue Feb 26, 2018 · 9 comments

Comments

@quozl
Copy link
Contributor

quozl commented Feb 26, 2018

Port Sugar to Python 3 and the Sugar Toolkit for GTK+ 3, providing a Python 3 implementation of this package with no Python 2 dependencies.

Requires most of sugarlabs/sugar-toolkit-gtk3#382, most of sugarlabs/sugar-datastore#7 and some of sugarlabs/hello-world#2 to be completed.

Progress goals:

  • port code in src/jarabe,
  • port code in extensions,
  • test display of available activities, which may be Python 2 or Python 3,
  • test starting the Hello World activity, a Python 3 GTK+ 3 activity,
  • test starting a Python 2 GTK+ 3 activity,
  • test starting a Python 2 GTK+ 2 activity,
  • port make files, and test that "make install" installs Python 3 binding.
  • update in-tree documentation,
  • fix newly introduced bugs,
  • make local Fedora and Debian packages for testing by others.

this is an issue for tracking a major project which is larger than one person's contributions, so developers should make pull requests to satisfy any of these items, and not ask to own the issue.

@quozl quozl changed the title Port to Six Port to Python 3 Feb 26, 2018
@ghost

This comment has been minimized.

@quozl

This comment has been minimized.

@manddy

This comment has been minimized.

@quozl

This comment has been minimized.

@GauthamSks

This comment has been minimized.

@quozl

This comment has been minimized.

@sugarlabs sugarlabs deleted a comment from vanitaa Mar 25, 2019
@bhulsken
Copy link
Contributor

bhulsken commented Aug 18, 2019

I have built fedora (29) RPMS to do some testing (if you're interested, you can find rpm and src.rpm at: https://steadydecline.net/public/sugar-python3/) . While the toolkit and such work, and most activities run (both python2 as well as python3 ones), sugar itself does not, due to a dependency on gwebsockets (sugar -> jarabe -> gwebsockets )

gwebsockets hasn't been maintained since 2014, and currently does not support python3

what is your plan? Port gwebsockets to python 3? Or just like telepathy, remove the dependency and use gi.repositories directly?

I'm asking, as I might spend a bit of time on porting gwebsockets, but wouldn't want to waste my time if you've decided to go another route.

P.S. this is the error in shell.log:

Traceback (most recent call last):
File "/usr/lib64/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/usr/lib64/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/usr/lib/python3.7/site-packages/jarabe/main.py", line 83, in
from jarabe import apisocket
File "/usr/lib/python3.7/site-packages/jarabe/apisocket.py", line 26, in
from gwebsockets.server import Server
ModuleNotFoundError: No module named 'gwebsockets'

@bhulsken
Copy link
Contributor

bhulsken commented Aug 18, 2019

Well.. since the port seemed trivial, I've given porting gwebsocket a shot, please see https://steadydecline.net/public/sugar-python3/ for a full set of RPM and .src.rpm that should lead to a running sugar desktop.

Sugar starts for me now with gwebsockets-python3, and the Python 3 port of Browse works, the Python 2 Physics activity works as well... some others (e.g. Speak) seem broken. And there's still quite a bit of chatter in shell.log about porting issues... see below.

I've submitted the python3 port of gwebsockets to redhat bugzilla, let's see if they update it..

----------- shell.log for a quick session... quite a few string decode issues and others due to porting issues -------------

failed to open /usr/lib64/dri/hybrid_drv_video.so
Not using hybrid_drv_video.so
Not using hybrid_drv_video.so
/usr/lib/python3.7/site-packages/jarabe/main.py:341: PyGIDeprecationWarning: Since version 3.11, calling threads_init is no longer needed. See: https://wiki.gnome.org/PyGObject/Threading
  GLib.threads_init()
/usr/lib/python3.7/site-packages/jarabe/main.py:249: PyGIDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "schema" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
  settings = Gio.Settings('org.sugarlabs.date')
/usr/lib/python3.7/site-packages/jarabe/main.py:256: PyGIDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "schema" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
  settings = Gio.Settings('org.sugarlabs.font')
/usr/lib/python3.7/site-packages/jarabe/main.py:270: PyGIDeprecationWarning: Using positional arguments with the GObject constructor has been deprecated. Please specify keyword(s) for "schema" or use a class specific constructor. See: https://wiki.gnome.org/PyGObject/InitializerDeprecations
  g_mode = Gio.Settings('org.sugarlabs.system.proxy').get_string('mode')
Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/dbus/connection.py", line 604, in msg_reply_handler
    reply_handler(*message.get_args_list(**get_args_opts))
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 298, in __get_devices_reply_cb
    self._check_device(dev_o)
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 317, in _check_device
    self._box.add_adhoc_networks(device)
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 552, in add_adhoc_networks
    self._adhoc_manager = get_adhoc_manager_instance()
  File "/usr/lib/python3.7/site-packages/jarabe/model/adhoc.py", line 35, in get_adhoc_manager_instance
    _adhoc_manager_instance = AdHocManager()
  File "/usr/lib/python3.7/site-packages/jarabe/model/adhoc.py", line 76, in __init__
    self._add_connection(channel)
  File "/usr/lib/python3.7/site-packages/jarabe/model/adhoc.py", line 199, in _add_connection
    settings.wireless.ssid = dbus.ByteArray(ssid)
TypeError: string argument without an encoding
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 506, in _ap_props_changed_cb
    self._add_ap_to_network(ap)
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 476, in _add_ap_to_network
    icon.set_filter(self._query)
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/networkviews.py", line 408, in set_filter
    normalized_name = normalize_string(self._display_name.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 506, in _ap_props_changed_cb
    self._add_ap_to_network(ap)
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 476, in _add_ap_to_network
    icon.set_filter(self._query)
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/networkviews.py", line 408, in set_filter
    normalized_name = normalize_string(self._display_name.decode('utf-8'))
1566148473.024936 WARNING root: Activity bundle /home/julia/Activities/Musicpainter.activity does not specify a license
1566148473.051665 WARNING root: Activity bundle /home/julia/Activities/SpaceWar.activity does not specify a license
1566148473.084297 WARNING root: Activity bundle /home/julia/Activities/Tessellations.activity does not specify a license
1566148473.113232 WARNING root: Activity bundle /home/julia/Activities/Fractionauts.activity does not specify a license
1566148473.138590 WARNING root: Activity bundle /home/julia/Activities/PJ.activity does not specify a license
1566148473.161572 ERROR root: ATTENTION: service_name property in the activity.info file is deprecated, should be changed to bundle_id
1566148473.163107 WARNING root: Activity bundle /home/julia/Activities/Tuxmath.activity does not specify a license
1566148473.242804 WARNING root: Activity bundle /home/julia/Activities/SuperChef.activity does not specify a license
1566148473.299110 WARNING root: Activity bundle /home/julia/Activities/Pacman.activity does not specify a license
1566148473.428368 WARNING root: Activity bundle /home/julia/Activities/Domino.activity does not specify a license
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 506, in _ap_props_changed_cb
    self._add_ap_to_network(ap)
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 476, in _add_ap_to_network
    icon.set_filter(self._query)
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/networkviews.py", line 408, in set_filter
    normalized_name = normalize_string(self._display_name.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
/usr/lib64/python3.7/site-packages/gi/overrides/Gtk.py:1641: Warning: g_value_transform: assertion 'G_IS_VALUE (src_value)' failed
  return _Gtk_main(*args, **kwargs)
/usr/lib64/python3.7/site-packages/gi/overrides/Gtk.py:1641: Warning: unable to set property 'buddy' of type 'PyObject' from value of type '(null)'
  return _Gtk_main(*args, **kwargs)
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/jarabe/journal/listmodel.py", line 166, in do_get_value
    metadata = self._result_set.read()
  File "/usr/lib/python3.7/site-packages/jarabe/journal/model.py", line 152, in read
    entries, self._total_count = self.find(query)
  File "/usr/lib/python3.7/site-packages/jarabe/journal/model.py", line 226, in find
    byte_arrays=True)
  File "/usr/lib64/python3.7/site-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib64/python3.7/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.TypeError: Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/dbus/service.py", line 707, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/python3.7/site-packages/carquinyol/datastore.py", line 400, in find
    return self._find_all(query, properties)
  File "/usr/lib/python3.7/site-packages/carquinyol/datastore.py", line 425, in _find_all
    uids = uids[offset:offset + limit]
TypeError: slice indices must be integers or None or have an __index__ method

Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/jarabe/journal/listview.py", line 425, in __select_set_data_cb
    uid = tree_model[tree_iter][ListModel.COLUMN_UID]
  File "/usr/lib64/python3.7/site-packages/gi/overrides/Gtk.py", line 1126, in __getitem__
    return self.model.get_value(self.iter, key)
TypeError: unknown type (null)
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/jarabe/journal/listmodel.py", line 166, in do_get_value
    metadata = self._result_set.read()
  File "/usr/lib/python3.7/site-packages/jarabe/journal/model.py", line 152, in read
    entries, self._total_count = self.find(query)
  File "/usr/lib/python3.7/site-packages/jarabe/journal/model.py", line 226, in find
    byte_arrays=True)
  File "/usr/lib64/python3.7/site-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib64/python3.7/site-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.TypeError: Traceback (most recent call last):
  File "/usr/lib64/python3.7/site-packages/dbus/service.py", line 707, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/python3.7/site-packages/carquinyol/datastore.py", line 400, in find
    return self._find_all(query, properties)
  File "/usr/lib/python3.7/site-packages/carquinyol/datastore.py", line 425, in _find_all
    uids = uids[offset:offset + limit]
TypeError: slice indices must be integers or None or have an __index__ method

/usr/lib64/python3.7/site-packages/gi/overrides/Gtk.py:1641: Warning: unable to set property 'text' of type 'gchararray' from value of type '(null)'
  return _Gtk_main(*args, **kwargs)
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/jarabe/model/shell.py", line 624, in _window_opened_cb
    home_activity.add_window(window, is_main_window(window,
AttributeError: 'NoneType' object has no attribute 'add_window'
1566148516.760332 ERROR dbus.proxies: Introspect error on :1.31:/org/laptop/Activity/a31cf2599c594a3b2b7d387c43469fd4bf084225: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
1566148516.762414 ERROR root: set_active() failed: org.freedesktop.DBus.Error.ServiceUnknown: The name :1.31 was not provided by any .service files
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/jarabe/model/shell.py", line 624, in _window_opened_cb
    home_activity.add_window(window, is_main_window(window,
AttributeError: 'NoneType' object has no attribute 'add_window'
1566148544.876915 ERROR root: Incorrect bundle
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/jarabe/journal/misc.py", line 149, in get_bundle
    return get_bundle_instance(file_path)
  File "/usr/lib/python3.7/site-packages/sugar3/bundle/activitybundle.py", line 456, in get_bundle_instance
    _bundle_instances[path] = ActivityBundle(path, translated=translated)
  File "/usr/lib/python3.7/site-packages/sugar3/bundle/activitybundle.py", line 118, in __init__
    info_file = self.get_file('activity/activity.info')
  File "/usr/lib/python3.7/site-packages/sugar3/bundle/bundle.py", line 126, in get_file
    f = six.StringIO(data)
1566148547.389607 ERROR root: set_active() failed: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
1566148547.398303 ERROR root: Model for activity id ba1ae2c0797226aa44e8df7765fbc667374ee17f does not exist.
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 506, in _ap_props_changed_cb
    self._add_ap_to_network(ap)
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/meshbox.py", line 476, in _add_ap_to_network
    icon.set_filter(self._query)
  File "/usr/lib/python3.7/site-packages/jarabe/desktop/networkviews.py", line 408, in set_filter
    normalized_name = normalize_string(self._display_name.decode('utf-8'))
1566148756.423295 ERROR root: set_active() failed: org.freedesktop.DBus.Error.NoReply: Message recipient disconnected from message bus without replying
1566148790.639280 ERROR root: Launcher was not registered for None

(metacity:1327): metacity-WARNING **: 13:55:48.101: CurrentTime used to choose focus window; focus window may not be correct.
Gdk-Message: 13:55:48.191: metacity: Fatal IO error 11 (Hulpbron is tijdelijk onbeschikbaar) on X server :0.```


@quozl
Copy link
Contributor Author

quozl commented Aug 19, 2019

Thanks. We had already ported gwebsockets, and tagged 0.5, see repository. Your port seems about the same, except for imports in the test harness, which we haven't got working yet. You might let Fedora know that we have a new version ready.

I've raised separate issues for the other errors. Thanks for testing on Fedora.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging a pull request may close this issue.

4 participants