Caffeine Indicator error on startup. ImportError: cannot import name '_gi'

Bug #1538116 reported by Johann Götz on 2016-01-26
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
caffeine (Ubuntu)
Medium
Unassigned

Bug Description

Caffeine indicator crashes on startup and complaining about missing _gi. (python_gi, python3_gi and python_gobject are all installed)

This was on
Ubuntu Xenial Xerus (development branch)
Release: 16.04

Caffeine Version: 2.8.3-3

Full mesage was:

Traceback (most recent call last):
  File "/usr/bin/caffeine-indicator", line 30, in <module>
    from gi.repository import GLib, Gtk, GObject, AppIndicator3
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
    import apt_pkg
ImportError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "/usr/bin/caffeine-indicator", line 30, in <module>
    from gi.repository import GLib, Gtk, GObject, AppIndicator3
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi'

ProblemType: Bug
DistroRelease: Ubuntu 16.04
Package: caffeine 2.8.3-3
ProcVersionSignature: Ubuntu 4.3.0-7.18-generic 4.3.3
Uname: Linux 4.3.0-7-generic x86_64
ApportVersion: 2.19.3-0ubuntu3
Architecture: amd64
CurrentDesktop: Unity
Date: Tue Jan 26 12:55:56 2016
InstallationDate: Installed on 2016-01-25 (0 days ago)
InstallationMedia: Ubuntu 16.04 LTS "Xenial Xerus" - Alpha amd64 (20160125)
PackageArchitecture: all
ProcEnviron:
 LANGUAGE=de_AT:de
 PATH=(custom, no user)
 XDG_RUNTIME_DIR=<set>
 LANG=de_AT.UTF-8
 SHELL=/bin/bash
SourcePackage: caffeine
UpgradeStatus: No upgrade log present (probably fresh install)

Johann Götz (johnny-goetz-0) wrote :
Launchpad Janitor (janitor) wrote :

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

Changed in caffeine (Ubuntu):
status: New → Confirmed
Robert Jordens (jordens) wrote :

Needs to be transitioned to python3.5.

Changed in caffeine (Ubuntu):
importance: Undecided → Medium
Changed in caffeine (Ubuntu):
status: Confirmed → Fix Released
Pascal Mons (anton+) wrote :

Where is your Fix Release ? I don't see anything. I believe in my Xenial 16.04 I have just fixed the error messages I got for caffeine and caffeine-indicator:

For /usr/bin/caffeine at the beginning of file in the import section I did add an import gi followed by a require_version i.e.

import gi
gi.require_version('Gtk', '3.0')
import pkg_resources
from gi.repository import GObject, Gtk, GLib

For /usr/bin/caffeine-indicator idem

import gi
gi.require_version('Gtk', '3.0')
gi.require_version('AppIndicator3', '0.1')
import pkg_resources
from gi.repository import GLib, Gtk, GObject, AppIndicator3

Now when launched by a Terminal cmd. line there is no warnings / no errors.

Still after moving from Trusty 14.04 I had to edit the Start-up Applications Command:

From /usr/bin/caffeine To /usr/bin/caffeine-indicator

Pascal Mons (anton+) wrote :

I use the latest version 2.8.3-3build1

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

Other bug subscribers