$ python -c ‘from gi.repository import Gtk’
-c: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.
what should i do?
$ python -c ‘from gi.repository import Gtk’
-c: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.
what should i do?
3
Answers
You got a warning because you are importing gtk wihtouht specifing the version. This is because gtk has several version so you should declare which want to use.
In order to do so you can open a python terminal (type python on your commandline) and execute the following code:
I had the same issue as described in the question. I tried to change the order of the above listed commands in the source file, but some extension of VS Code was resetting the order to bottom up the oder suggested in the above answer. When I force-saved the code with the sequence as suggested, it solved the query. This might work in most cases. Thank you.
I had same issue.
In my error, it lists the file location of where the code needs to be placed.
C:usersmeradiocondalibsite-packagesgnuradiogrcmain.py
When i used a notepad to edit the file I found the code from the post above, but after a set of three import commands.
I changed the order to this and no longer receive the error.
I hope this helps.