AnswerBun.com

kazam fails with "PyGIWarning: Gtk was imported without specifying a version first..."

Ask Ubuntu Asked by Gaurab Kumar on October 16, 2020

After installing kazam screen casting software, it is not launching.

I am using Ubuntu 17.04.

Update:
enter image description here

    /usr/bin/kazam:32: 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 Gtk
/usr/lib/python3/dist-packages/kazam/frontend/window_area.py:30: 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 Gtk, GObject, Gdk, Wnck, GdkX11
/usr/lib/python3/dist-packages/kazam/backend/gstreamer.py:35: PyGIWarning: Gst was imported without specifying a version first. Use gi.require_version('Gst', '1.0') before import to ensure that the right version gets loaded.
  from gi.repository import GObject, Gst
/usr/lib/python3/dist-packages/kazam/frontend/indicator.py:148: PyGIWarning: AppIndicator3 was imported without specifying a version first. Use gi.require_version('AppIndicator3', '0.1') before import to ensure that the right version gets loaded.
  from gi.repository import AppIndicator3
/usr/lib/python3/dist-packages/kazam/frontend/indicator.py:97: PyGIWarning: Keybinder was imported without specifying a version first. Use gi.require_version('Keybinder', '3.0') before import to ensure that the right version gets loaded.
  from gi.repository import Keybinder
Segmentation fault (core dumped)

4 Answers

Solved: I just needed to install python3-xlib:

sudo apt-get update
sudo apt-get install python3-xlib

Correct answer by Gaurab Kumar on October 16, 2020

On Ubuntu 20.04, I had better luck with a GitHub fork. Here are the steps:

By default, this installs in /usr/local/bin/kazam, which should already be on your PATH.

For me, this local kazam also appeared as a launcher with icons. However, these may be left over from the Ubuntu package or from the PPA above.

If you have a problem selecting the microphone, use this command post-install (using the appropriate python version):

sudo sed -i 's/time.clock/time.perf_counter/g' python3.8/dist-packages/kazam/pulseaudio/pulseaudio.py

Answered by Andrew Olney on October 16, 2020

Simply installing python3-xlib solved your particular Segmentation Fault issue with Kazam, but you may have noticed there are still several PyGI warnings about importing "without specifying a version first".

Since this question is google's #1 on such warnings (that's how I stumbled here), this is how to change the code to prevent such warnings, as described by the warnings themselves.

Instead of:

from gi.repository import Gtk, GObject, Gdk, Wnck, GdkX11, Gst, AppIndicator3

Which emits several warnings:

__main__:1: 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.
__main__:1: 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.
__main__:1: PyGIWarning: Gst was imported without specifying a version first. Use gi.require_version('Gst', '1.0') before import to ensure that the right version gets loaded.
__main__:1: PyGIWarning: AppIndicator3 was imported without specifying a version first. Use gi.require_version('AppIndicator3', '0.1') before import to ensure that the right version gets loaded.

Use this, according to official PyGOobject Documentation:

import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Wnck', '3.0')
gi.require_version('Gst', '1.0')
gi.require_version('AppIndicator3', '0.1')
from gi.repository import Gtk, GObject, Gdk, Wnck, GdkX11, Gst, AppIndicator3

Apparently not all gi's submodules require specifying a version.

Or alternatively you can require all versions in a single statement using the require_versions() function (note the plural), which takes a single dictionary of modules and their respective versions:

import gi
gi.require_versions({
    'Gtk':  '3.0',
    'Wnck': '3.0',
    'Gst':  '1.0',
    'AppIndicator3': '0.1',
})
from gi.repository import Gtk, GObject, Gdk, Wnck, GdkX11, Gst, AppIndicator3

This function is not listed in official docs, but it was added in PyGObject 3.21.0 released in 2016.

Answered by MestreLion on October 16, 2020

The problem with this segmentation fault is in Kazam hotkeys bindings. Maybe the system cannot give some keybingings to Kazam, thus we get an exception.

The rough solution is to remove Kazam’s global keybingings:

  1. Open the file:
    /usr/lib/python3/dist-packages/kazam/frontend/indicator.py

  2. Find these strings (about line 100 or so):

    Keybinder.bind("<Super><Ctrl>R", self.cb_hotkeys, "start-request")
    Keybinder.bind("<Super><Ctrl>F", self.cb_hotkeys, "stop-request")
    Keybinder.bind("<Super><Ctrl>P", self.cb_hotkeys, "pause-request")
    Keybinder.bind("<Super><Ctrl>W", self.cb_hotkeys, "show-request")
    Keybinder.bind("<Super><Ctrl>Q", self.cb_hotkeys, "quit-request")
    
  3. Comment them out:

    #Keybinder.bind("<Super><Ctrl>R", self.cb_hotkeys, "start-request")
    #Keybinder.bind("<Super><Ctrl>F", self.cb_hotkeys, "stop-request")
    #Keybinder.bind("<Super><Ctrl>P", self.cb_hotkeys, "pause-request")
    #Keybinder.bind("<Super><Ctrl>W", self.cb_hotkeys, "show-request")
    #Keybinder.bind("<Super><Ctrl>Q", self.cb_hotkeys, "quit-request")
    
  4. Save the file.

  5. Run Kazam.

  6. You’re awesome.

After that, you cannot use those hotkeys though, but at least Kazam will work.

Answered by Sasha MaximAL on October 16, 2020

Add your own answers!

Related Questions

Error in Boot Sequence

0  Asked on January 4, 2021 by malika-arora

         

How do I upgrade WordPress Installed by APT?

1  Asked on January 3, 2021 by mark-lee

       

How can i move multiple files to folder with same name

3  Asked on January 3, 2021 by tucanco

     

Iptables chain doesn’t save

1  Asked on January 3, 2021 by jogarcia

   

using youtube-dl to download entire youtube channel

2  Asked on January 2, 2021 by sam-vega

   

Change sort order in Nemo by keyboard

0  Asked on January 2, 2021 by avb

 

Why doesn’t gir1.2-vips-8.0 contain Vips.Image.grey?

2  Asked on January 2, 2021 by int_ua

   

NVIDIA Driver Suddenly Failed (20.04 LTS)

2  Asked on January 1, 2021 by alexwh

         

Ubuntu 20.04 LTS lan network problem

0  Asked on January 1, 2021 by yamifm0f

       

Disable GUI login buttons

0  Asked on December 31, 2020 by user1098490

         

Samsung TV “Mirror Screen”

3  Asked on December 31, 2020

     

Permision Denied – minecraft-launcher

0  Asked on December 31, 2020 by shadowflame

 

How to boot from folder in virtualbox?

1  Asked on December 30, 2020 by bladelock

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir