Caffeine Crashes

Hello there Caffeine is starting but when I click on it in Plnak it disappears.
When I open it in terminal this is what it says. Not sure what it means.

khalil@khalil-Lenovo-G50-70:~$ caffeine
/usr/bin/caffeine:25: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import GObject, Gtk, GLib

Any help guys.

Thanks in advance.

K.I.

The PyGIWarning there is mostly harmless. It’s a warning to the developer they wasn’t explicit in which version to load.

I see. But is there a way to make it work? Since it is crashing as I said.

As I do not use Caffeine, my help will be limited. :frowning: There isn’t sufficient details to know why it’s crashing.

Is there any verbose option for this application? (Try -v or see --help for any commands you could try)

Thanks anyhow. The help doesn’t give much more info.

khalil@khalil-Lenovo-G50-70:~$ caffeine --help
/usr/bin/caffeine:25: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import GObject, Gtk, GLib
usage: caffeine [-h] [-V]

Prevent desktop idleness in full-screen mode

optional arguments:
  -h, --help     show this help message and exit
  -V, --version  show program's version number and exit

Hi @Khalil_Ibrahim,

have you checked this bit?:

Use gi.require_version(‘Gtk’, ‘3.0’) before import to ensure that the right version gets loaded.
from gi.repository import GObject, Gtk, GLib
usage: caffeine [-h] [-V]

Hi wolfman! I am not such an advanced user. So even if (linguistically speaking) the course of action seems obvious. To me it couldn’t be further.

Regards

Hi @Khalil_Ibrahim,

try downloading the 2.8 package from here and installing with Gdebi but remove the other package first even if it is the same package number!:

https://pkgs.org/ubuntu-16.04/ubuntu-universe-i386/caffeine_2.8.3-3build1_all.deb.html

tried with no better outcome.

khalil@khalil-Lenovo-G50-70:~$ caffeine
/usr/bin/caffeine:25: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version(‘Gtk’, ‘3.0’) before import to ensure that the right version gets loaded.
from gi.repository import GObject, Gtk, GLib

You can bypass that warning but I doubt it would change the behaviour of the application, so there’s no point. :neutral_face:

(You’d add this line at the top of /usr/bin/caffeine in a text editor)

#!/usr/bin/python3
gi.require_version("Gtk", "3.0")


Which version of Ubuntu MATE by the way?

From the package’s description, this application runs as an indicator, and shouldn’t appear in Plank. Does the program run then immediately exit to the terminal prompt? To me, it looks like it’s running, but doesn’t output anything in the terminal.

2 Likes

you need to add
import gi gi.require_version('Gtk', '3.0')

before line 25 and it won’t crash, at least not right away.

filed bug report.

1 Like

Not it’s not working with this script either. I am on 16.04 and yes it is opening in plank not in the indicator area! I don’t know why. And if I press on it in Plank it crashes.

No it still crashes from Plank when I add the lines, but in terminal nothing happens. So it doesn’t show error or anything else. In the process manager it is sleeping and I don’t see it in the indicator area. Any clue? Perhaps we should modify caffeine-indicator as well?

After playing around I finally got a working version. I had to go back to version 2.4.1 to get a version that works correctly. This was released in 2013. All the previous builds crash on startup.

If you want to try it I have an unsigned build that will complain about newer version available and all that but for what it’s worth here it is.

Yes, thanks for the effort and sorry for the delay. I was away.

I have tried to install it, but it says :
Error: Dependency is not satisfiable:python-central (>= 0.6.11)

Actually, I am not so sure it is worth all that while. I will just deactivate screensaver manually. Thanks anyhow.

Regards

MATE includes an Inhibit applet which works like Caffine.

1 Like