I am using elementary OS and I want to make my own notifications using python 3. I know that a simple way of doing that is by import subprocess
. However, reading around the web I found out that it's not the most appropriate way of doing it. Instead I should use from gi.repository import Notify
but I get this error
__main__:1: PyGIWarning: Notify was imported without specifying a version first. Use gi.require_version('Notify', '0.7') before import to ensure that the right version gets loaded.
I have been trying to solve this and using the following code seems to work.
import gi
gi.require_version("Notify", "0.7")
from gi.repository import Notify
Can someone explain the why this error was produced in the first place and why this is the way to solve it (if it's the correct way)? Thank you in advance.
PS. I asked in the www.elementaryos.stackexchange.com but I didn't get any answer. Maybe they are not familiar with this.
You can try installing package
pip install gi==0.0.7
orpip install pgi==0.0.7
OR you can use pgi instead of gi.
It happens because of version mismatch issue. I have same problem and just tried on my system and it works.