Python warnings: modules imported without specifying a version first

Bug #1502173 reported by Laurent Bonnaud
160
This bug affects 21 people
Affects Status Importance Assigned to Milestone
apport (Ubuntu)
Fix Released
Low
Unassigned
Xenial
Fix Released
Low
Brian Murray

Bug Description

[Description]
Users receive warnings about importing of python modules without a version being specified. While this isn't a big deal in itself we get lots of bug reports from people about this issue since it is so obvious. Given that Ubuntu 16.04 is an LTS release we should fix this and prevent further reporting of the issue.

[Test Case]
1) run /usr/share/apport/apport-gtk in a terminal
2) Observe the following

/usr/share/apport/apport-gtk:16: PyGIWarning: Wnck was imported without specifying a version first. Use gi.require_version('Wnck', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import GLib, Wnck, GdkX11, Gdk
/usr/share/apport/apport-gtk:16: PyGIWarning: GdkX11 was imported without specifying a version first. Use gi.require_version('GdkX11', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import GLib, Wnck, GdkX11, Gdk

with the version of apport in -proposed you'll no longer receive the warning.

[Regression Potential]As with any SRU this could cause a regression in the software if the fix is typo'ed so review it carefully. If there isn't a typo and then the chance of a regression is very very very low.

Original Description
--------------------

Hi,

here is the problem:

$ /usr/share/apport/apport-gtk
/usr/share/apport/apport-gtk:16: PyGIWarning: Wnck was imported without specifying a version first. Use gi.require_version('Wnck', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import GLib, Wnck, GdkX11, Gdk
/usr/share/apport/apport-gtk:16: PyGIWarning: GdkX11 was imported without specifying a version first. Use gi.require_version('GdkX11', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import GLib, Wnck, GdkX11, Gdk

ProblemType: BugDistroRelease: Ubuntu 15.10
Package: apport-gtk 2.19-0ubuntu1
Uname: Linux 4.2.2-040202-generic x86_64
ApportVersion: 2.19-0ubuntu1
Architecture: amd64
CurrentDesktop: KDE
Date: Fri Oct 2 16:17:14 2015
EcryptfsInUse: Yes
PackageArchitecture: allSourcePackage: apport
UpgradeStatus: Upgraded to wily on 2015-10-02 (0 days ago)

Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in apport (Ubuntu):
status: New → Confirmed
Changed in apport (Ubuntu):
importance: Undecided → Low
Revision history for this message
Numan Demirdöğen (if.gnu.linux) wrote :

This bug still exists in apport-gtk on Ubuntu 16.04.
To fix the issue:
1- Open apport-gtk script
                         sudo nano /usr/share/apport/apport-gtk

2- Change
                         import os.path, sys, subprocess, os, re
     line to
                         import os.path, sys, subprocess, os, re, gi

3- After 'import' line before 'from gi.repository import GLib, Wnck, GdkX11, Gdk' line, add
                         gi.require_version('Wnck', '3.0')
                         gi.require_version('GdkX11', '3.0')

LC_ALL=C apt-cache policy apport-gtk
apport-gtk:
  Installed: 2.20-0ubuntu3
  Candidate: 2.20-0ubuntu3
  Version table:
 *** 2.20-0ubuntu3 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu xenial/main i386 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Thomas Mayer (thomas303) wrote :

Numan's workaround did the trick for me (with up-to-date ubuntu 16.04). The warning does not occur after that.

https://bugs.launchpad.net/ubuntu/+source/apport/+bug/1502173/comments/3

Martin Pitt (pitti)
Changed in apport (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
anatoly techtonik (techtonik) wrote :

Thanks Numan for the patch. Inline text helped me gain inspiration to get into launchpad patch submission process - https://askubuntu.com/questions/372654/how-do-i-submit-a-patch-to-a-launchpad-project

Revision history for this message
Numan Demirdöğen (if.gnu.linux) wrote :

You are wellcome:) I tried to push patch to branch but how-to in the Ubuntu wiki ( as far as I remember ) was a bit complicated for someone like me who is just an end user:) The answer in the Askubuntu is much easier.

Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :

This bug still exists partially in yakkety:

$ /usr/share/apport/apport-gtk
/usr/share/apport/apport-gtk:16: PyGIWarning: Wnck was imported without specifying a version first. Use gi.require_version('Wnck', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import GLib, Wnck, GdkX11, Gdk

tags: added: xenial yakkety
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.20.3-0ubuntu8

---------------
apport (2.20.3-0ubuntu8) yakkety; urgency=medium

  * Prefer pycodestyle build dependency over pep8.
  * debian/tests/upstream-system: Create and export $GNUPGHOME, to work with
    gnupg2.
  * apport-gtk: Specify module version with GI imports to avoid warnings.
    Thanks Anatoly Techtonik. (LP: #1502173)
  * Disable Launchpad crash upload for final Ubuntu 16.10.

 -- Martin Pitt <email address hidden> Mon, 10 Oct 2016 14:28:17 +0200

Changed in apport (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote :

Just to prevent more bug reports about this we might as well fix it in 16.04.

Changed in apport (Ubuntu Xenial):
importance: Undecided → Low
milestone: none → ubuntu-16.04.2
status: New → Triaged
assignee: nobody → Brian Murray (brian-murray)
description: updated
description: updated
Changed in apport (Ubuntu Xenial):
status: Triaged → In Progress
description: updated
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello Laurent, or anyone else affected,

Accepted apport into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/apport/2.20.1-0ubuntu2.5 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in apport (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :

Thanks for the fix!
I upgraded my system to yakkety therefore I cannot test myself.

Revision history for this message
Numan Demirdöğen (if.gnu.linux) wrote :

I confirm that with the 2.20.1-0ubuntu2.5 version of apport-gtk packages, the bug is fixed.

LC_ALL=C apt-cache policy apport-gtk
apport-gtk:
  Installed: 2.20.1-0ubuntu2.5
  Candidate: 2.20.1-0ubuntu2.5
  Version table:
 *** 2.20.1-0ubuntu2.5 400
        400 http://archive.ubuntu.com/ubuntu xenial-proposed/main amd64 Packages
        400 http://archive.ubuntu.com/ubuntu xenial-proposed/main i386 Packages
        100 /var/lib/dpkg/status
     2.20.1-0ubuntu2.4 500
        500 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages
        500 http://archive.ubuntu.com/ubuntu xenial-security/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu xenial-security/main i386 Packages
     2.20.1-0ubuntu2 500
        500 http://archive.ubuntu.com/ubuntu xenial/main amd64 Packages
        500 http://archive.ubuntu.com/ubuntu xenial/main i386 Packages

dpkg -l | grep apport-gtk
ii apport-gtk 2.20.1-0ubuntu2.5 all GTK+ frontend for the apport crash report system

lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.1 LTS
Release: 16.04
Codename: xenial

tags: added: verification-done
removed: verification-needed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package apport - 2.20.1-0ubuntu2.5

---------------
apport (2.20.1-0ubuntu2.5) xenial; urgency=medium

  * apport-gtk: Specify module version with GI imports to avoid warnings.
    Thanks Anatoly Techtonik. (LP: #1502173)

 -- Brian Murray <email address hidden> Tue, 03 Jan 2017 15:31:33 -0800

Changed in apport (Ubuntu Xenial):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for apport has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
lnxusr (bjwest) wrote :

This is still happening in 17.10! Why is this marked as fixed several times but still propagating up the versions? This needs to be fixed once and for all.

Revision history for this message
Brian Murray (brian-murray) wrote :

I was unable to recreate this problem on Ubuntu 17.10. Can you provide some more details about the version of apport you have installed or what exactly you are seeing?

bdmurray@impulse:~$ apt-cache policy apport
apport:
  Installed: 2.20.7-0ubuntu3.5
  Candidate: 2.20.7-0ubuntu3.5
  Version table:
 *** 2.20.7-0ubuntu3.5 500
        500 http://192.168.10.7/ubuntu artful-updates/main amd64 Packages
        500 http://192.168.10.7/ubuntu artful-updates/main i386 Packages
        500 http://192.168.10.7/ubuntu artful-security/main amd64 Packages
        500 http://192.168.10.7/ubuntu artful-security/main i386 Packages
        100 /var/lib/dpkg/status
     2.20.7-0ubuntu3 500
        500 http://192.168.10.7/ubuntu artful/main amd64 Packages
        500 http://192.168.10.7/ubuntu artful/main i386 Packages
bdmurray@impulse:~$ /usr/share/apport/apport-gtk

Revision history for this message
Laurent Bonnaud (laurent-bonnaud) wrote :

On my 17.10 systems, this bug no longer shows up.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.