From unknown Wed Apr 15 10:41:03 2026
X-Loop: owner@bugs.x2go.org
Subject: Bug#989: [X2Go-Dev] pyhoca-gui fails to fall back to Gtk-2.0 notifications (pynotify)
Reply-To: Mihai Moldovan <ionic@ionic.de>, 989@bugs.x2go.org
Resent-From: Mihai Moldovan <ionic@ionic.de>
Resent-To: x2go-dev@lists.x2go.org
Resent-CC: X2Go Developers <x2go-dev@lists.x2go.org>
X-Loop: owner@bugs.x2go.org
Resent-Date: Thu, 04 Feb 2016 23:25:01 +0000
Resent-Message-ID: <handler.989.B989.145462804122757@bugs.x2go.org>
Resent-Sender: owner@bugs.x2go.org
X-X2Go-PR-Message: followup 989
X-X2Go-PR-Package: pyhoca-gui
X-X2Go-PR-Keywords: 
Received: via spool by 989-submit@bugs.x2go.org id=B989.145462804122757
          (code B ref 989); Thu, 04 Feb 2016 23:25:01 +0000
Received: (at 989) by bugs.x2go.org; 4 Feb 2016 23:20:41 +0000
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on
	ymir.das-netzwerkteam.de
X-Spam-Level: 
X-Spam-Status: No, score=-2.0 required=3.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham
	version=3.3.2
Received: from localhost (localhost [127.0.0.1])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTP id 527B55DA90
	for <989@bugs.x2go.org>; Fri,  5 Feb 2016 00:20:37 +0100 (CET)
X-Virus-Scanned: Debian amavisd-new at ymir.das-netzwerkteam.de
Received: from ymir.das-netzwerkteam.de ([127.0.0.1])
	by localhost (ymir.das-netzwerkteam.de [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id zatuhVaQBTIg for <989@bugs.x2go.org>;
	Fri,  5 Feb 2016 00:20:37 +0100 (CET)
Received: from Root24.de (powered.by.root24.eu [5.135.3.88])
	by ymir.das-netzwerkteam.de (Postfix) with ESMTP id F2ACF5DA86
	for <989@bugs.x2go.org>; Fri,  5 Feb 2016 00:20:36 +0100 (CET)
Received: from nopileos.local (home.ionic.de [217.92.117.31])
	by mail.ionic.de (Postfix) with ESMTPSA id EEC2C4F00DDC;
	Fri,  5 Feb 2016 00:20:35 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=ionic.de; s=default;
	t=1454628036; bh=/nINmoAORC1yXYDXyOSldG0GsuQbGxcxIjY76D3UneU=;
	h=Subject:To:References:From:Cc:Date:In-Reply-To:From;
	b=CSXQgOyg9SWXWgJMTDD4ykC2hRTh1sot7W0MoenH5AwayG9vbRTZCi226LBAAycJb
	 muQSQqbBwyium9fCVOJp+e7WbhMo7BtnYWasq4j0uXsjx9eNUBH9qKzWZC7UmMmAPg
	 510UFj2Lg10eWXkcBlyngKPgGTz3aXXS9/UnRW3Q=
To: =?UTF-8?Q?Ond=C5=99ej?= Grover <ondrej.grover@gmail.com>,
 989@bugs.x2go.org
References: <CAOyjJOKY4VpqcqKJ2St58tepAgKipgdc=TeGJtgsFpZf5qccdA@mail.gmail.com>
 <56B38113.70103@ionic.de>
 <CAOyjJOKCw0QkwfB45NmUaSNkoYeeOygfsS3xY=BFpZdtgeYjEA@mail.gmail.com>
From: Mihai Moldovan <ionic@ionic.de>
X-Enigmail-Draft-Status: N1110
Cc: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Message-ID: <56B3DCC2.5090704@ionic.de>
Date: Fri, 5 Feb 2016 00:20:34 +0100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0)
 Gecko/20100101 Thunderbird/38.5.1
MIME-Version: 1.0
In-Reply-To: <CAOyjJOKCw0QkwfB45NmUaSNkoYeeOygfsS3xY=BFpZdtgeYjEA@mail.gmail.com>
Content-Type: multipart/signed; micalg=pgp-sha512;
 protocol="application/pgp-signature";
 boundary="ohOV3PmX1ktInVVmJlKs0DoDXrRQKlwjp"

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--ohOV3PmX1ktInVVmJlKs0DoDXrRQKlwjp
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On 04.02.2016 06:07 PM, Ond=C5=99ej Grover wrote:
> Thank you for looking into this.
>=20
> On Thu, Feb 4, 2016 at 5:49 PM, Mihai Moldovan <ionic@ionic.de
> <mailto:ionic@ionic.de>> wrote:
>=20
>     I've been looking around for a way to actually rollback a failing m=
odule import
>     and came up with zit.
>=20
> AFAIK that's not really possible in Python as of writing this, especial=
ly with
> complicated binary modules.
> I think a solution might be to abandon the common Python EAFP idiom, be=
cause it
> assumes graceful failure without such ugly side-effects. However, I'm n=
ot sure
> what the LBYL alternative is in this case. But I think there should be =
one,
> possibly loading just some high-level gi module to list available APIs?=


Probably not.

In a new python2 interpreter, try this:

import sys
print sys.modules
import gi.repository
print sys.modules

I guess gi.repository is the only module that could be used to query addi=
tional
modules (like Notify.)

The modules list explodes. With GI, we end up in GI hell. And there's no =
exit.
Ever. Again.


I'd rather suggest the following: another try block, looking for pynotify=
2.

On Debian, I'd switch the dependencies to use gir1.2-notify-0.7 and pytho=
n-gi,
or python-notify2 (dropping python-notify completely), while *SUSE, EPEL =
and
Fedora will continue depending upon the GI modules for newer versions and=

pynotify for older versions (at least Fedora doesn't seem to have pynotif=
y2.)

It should probably work as a drop-in replacement for pynotify in our case=
 (i.e.,
we don't use any callbacks or anything fancy.)

Going forward, the deprecated gobject modules for GTK2 will likely be rem=
oved at
some point anyway and we should focus on GTK3.

Any objections?



Mihai


--ohOV3PmX1ktInVVmJlKs0DoDXrRQKlwjp
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCgAGBQJWs9zCAAoJEB/WLtluJTqHZ5EQAN/QhoVPrewDsJPg3V4qbaCk
urZ5eIlpk+njxr03MhiX2nHKGWn50XiswavaKcIWHoXaj9afqH4byIZBpKNhsds0
EPqXaJvbrU2osOtfV/HqPyj9nk3Fds0Wj9xuR/tGvs+gA+7qnk7hS6evtzlz+NTh
aR602dXH1Cl9GWtNxDLacmVRBBlm+1idD/ncHhjKKdJKzuDRVgqxmhef2pqlnd8h
/Jgv956IJ5DfLs1zNarxyb3ztgoJ6iX/xE3fO5vHfxZcaJcwO8Uk7xXDH+NwqRsb
WmybB585Gr4SG+3r+4FF1p+mTdCCdHcOhB6cj9DD7cNQuCJpYKN8dXGDMzI5UNK7
QhbuTA1TCYagX0Q9MtZQ4n/rpksZtmZ5dNg6SSN7DKBnovrTzb1bQtaEP2H5czck
dA6hiIhqVJB4P0GeWB14AzVIjUkxGwOxZWJ2nIxX5CpZ9/MuT0nBzrVApWuFO4RD
N5z5eq2ie3oEwuYaQQrUOK8ntNjLhn0XaynTFWaKTKNF712Neg2kX8iOWWOAA2Qh
HxAYorfwQlqjLcATMUTFfYcoPeLeKxh5RIHanx9tHcBFI455yHaN1adI3HbbO6EZ
8cPcJUsc01cIrxbLL7H5vSpy6ARwYOhEgHVeuiN3iLKIkTjIlKhTIexiP8YvBp20
OL1yDDKVQhr4Bv1ENoqF
=dfXF
-----END PGP SIGNATURE-----

--ohOV3PmX1ktInVVmJlKs0DoDXrRQKlwjp--
