Bug 6514 - Python module "pynotify" produces warning messages when imported
Summary: Python module "pynotify" produces warning messages when imported
Status: RESOLVED DUPLICATE of bug 10176
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 2
Hardware: i586 Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Philippe Makowski
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-19 22:47 CEST by R Topics
Modified: 2013-06-05 22:28 CEST (History)
3 users (show)

See Also:
Source RPM: python-notify python-gobject
CVE:
Status comment:


Attachments
Work around solution to suppress pynotify warning messages (1.67 KB, text/x-python)
2012-09-25 16:02 CEST, R Topics
Details

Description R Topics 2012-06-19 22:47:13 CEST
Installation: Mageia 2 KDE 586 installed using Live CD

uname -a: Linux magnum 3.3.6-desktop586-2.mga2 #1 SMP Thu May 17 16:35:38 UTC 2012 i686 i686 i386 GNU/Linux

Package name: python-notify-0.1.1-7.mga2


Python module "pynotify" produces the following warning messages after it is imported:

** (process:3893): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'

** (process:3893): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'

** (process:3893): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'


Reproducible: Yes


To produce warning messages do the following:

    install package python-notify-0.1.1-7.mga2

    bring up a terminal window

    type "python" at the prompt to start interactive python session

    type "import pynotify" and the warning messages will appear


pynotify does work but it is annoying to get these warnings messages when running a python script that uses it.
Manuel Hiebel 2012-06-20 13:28:44 CEST

Assignee: bugsquad => makowski.mageia
Source RPM: (none) => python-notify

Comment 1 Philippe Makowski 2012-06-21 18:09:27 CEST
I got the same under Fedora
seems that it have to be reported upstream
Philippe Makowski 2012-07-07 13:02:00 CEST

Whiteboard: (none) => NEEDHELP

Comment 2 Philippe Makowski 2012-07-07 13:04:30 CEST
may be something related to https://bugzilla.redhat.com/show_bug.cgi?id=790053 ?
Comment 3 Marja Van Waes 2012-07-09 08:55:28 CEST
cc'ing some committers of this package

Hi committers,

There is NEEDHELP on the whiteboard, so your help is very welcome :)

Btw, is upstream dead, our is our link to it wrong? http://www.galago-project.org/news/index.php The link to the bug list doesn't work http://trac.galago-project.org/report
Fedora and Suse link to galago-project.org too. If upstream moved, I don't manage to find the new site.

CC: (none) => jani.valimaa, mageia, marja11, thierry.vignaud

Comment 4 Philippe Makowski 2012-07-09 18:51:39 CEST
in fact pynotify is for Gtk2, not Gtk3
so may be we should drop it

or the user have to do :
"from gi.repository import Notify"
instead of only "import pynotify"

more reading on this :
http://askubuntu.com/questions/160114/error-when-importing-pynotify
http://san-ho-zay.tumblr.com/post/18557776154/using-libnotify-with-python-and-gtk3
Jani Välimaa 2012-08-08 21:41:47 CEST

CC: jani.valimaa => (none)

Comment 5 Philippe Makowski 2012-09-05 19:40:37 CEST
upstream dead, pynotify is for Gtk2, not Gtk3

Solution :

he user have to do :
"from gi.repository import Notify"
instead of only "import pynotify"

more reading on this :
http://askubuntu.com/questions/160114/error-when-importing-pynotify
http://san-ho-zay.tumblr.com/post/18557776154/using-libnotify-with-python-and-gtk3

it will not be fixed
even we should drop this package.
Comment 6 Marja Van Waes 2012-09-08 16:04:51 CEST
(In reply to comment #5)
> upstream dead, pynotify is for Gtk2, not Gtk3
> 
> Solution :
> 
> he user have to do :
> "from gi.repository import Notify"
> instead of only "import pynotify"
> 
> more reading on this :
> http://askubuntu.com/questions/160114/error-when-importing-pynotify
> http://san-ho-zay.tumblr.com/post/18557776154/using-libnotify-with-python-and-gtk3
> 
> it will not be fixed
> even we should drop this package.

Can you please obsolete it, then?

https://wiki.mageia.org/en/Packaging_guidelines#Obsoleting_a_package
Comment 7 Philippe Makowski 2012-09-09 20:56:10 CEST
I will first try to apply this patch (http://pkgs.fedoraproject.org/cgit/notify-python.git/tree/notify-python-0.1.1-fix-GTK-symbols.patch)  from Fedora
Comment 8 Philippe Makowski 2012-09-16 18:40:02 CEST
Patched version in update testing python-notify-0.1.1-8.mga2
python-notify-0.1.1-8.mga3
Comment 9 R Topics 2012-09-19 02:29:55 CEST
Trying the patched version.  Still generates the same warnings for me when importing pynotify in an interactive session.

** (process:4263): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'

** (process:4263): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'

** (process:4263): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'
Comment 10 Philippe Makowski 2012-09-20 17:37:56 CEST
so I have no solution
an under Fedora, some times it appends, some time not
Comment 11 Philippe Makowski 2012-09-24 18:34:01 CEST
Do you aggree if I obsolete this package, and package instead this one : http://pypi.python.org/pypi/notify2  ?

Quoted from http://www.mail-archive.com/debian-python@lists.debian.org/msg08784.html


This is intended as a replacement for pynotify (aka notify-python,
python-notify), so it broadly copies the API from that package,
although it's not a drop in replacement. Why is a replacement needed?

- notify2 is compatible with Gtk 3 and Qt 4. pynotify can't even be
imported in the same process as the gobject introspection bindings for
Gtk 3, and its callbacks depend on the Gtk 2 event loop.
- notify2 is compatible with Python 3; pynotify probably can't easily
be made to support Python 3.
- notify2 has useful docstrings and function signatures for introspection
- Getting things wrong with pynotify can easily segfault your process.
notify2 should just raise a Python exception.
- notify2 is written in Python, not C, so it's shorter, more readable,
and easier to maintain.
Comment 12 R Topics 2012-09-25 16:02:44 CEST
Created attachment 2856 [details]
Work around solution to suppress pynotify warning messages
Comment 13 R Topics 2012-09-25 16:06:05 CEST
Lost my comments with the attachment.  Here they are:

Found a work around solution by lunaryorn on stackoverflow.com:

    http://stackoverflow.com/questions/11567930/gtk-errors-when-importing-pynotify
    
It works in my applications.
Comment 14 Philippe Makowski 2013-06-05 21:14:42 CEST
In fact the bug is in gtk module, when you do "import pynotify" ,
__init__.py do import gtk

python
Python 2.7.3 (default, Jan 13 2013, 20:09:12) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import gtk

** (process:10833): WARNING **: Trying to register gtype 'GMountMountFlags' as enum when in fact it is of type 'GFlags'

** (process:10833): WARNING **: Trying to register gtype 'GDriveStartFlags' as enum when in fact it is of type 'GFlags'

** (process:10833): WARNING **: Trying to register gtype 'GSocketMsgFlags' as enum when in fact it is of type 'GFlags'
Gtk-Message: Failed to load module "canberra-gtk-module"
>>> 

so the bug have to be reported and fixed in gtk module
Philippe Makowski 2013-06-05 21:56:40 CEST

Source RPM: python-notify => python-notify pygtk2.0

Comment 15 Philippe Makowski 2013-06-05 22:28:03 CEST
The initial reported bug was in fact in python-gobject, not in python-notify

*** This bug has been marked as a duplicate of bug 10176 ***

Status: NEW => RESOLVED
Resolution: (none) => DUPLICATE
Source RPM: python-notify pygtk2.0 => python-notify python-gobject
Whiteboard: NEEDHELP => (none)


Note You need to log in before you can comment on or make changes to this bug.