When I try to import Webkit from gi.repository, it gives an ImportError:
from gi.repository import Webkit
ERROR:root:Could not find any typelib for Webkit
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name Webkit
What am I doing wrong?
Your error seems a typo and the library is not found for that.
You have to put “WebKit” instead of “Webkit”.
Additionaly if you use Ubuntu check the library existence with:
If doesn’t exist you need install the package gir1.2-webkit-3.0:
Then on python script:
Note: For Ubuntu 17.10 or later, the library seems called WebKit2. Which could be installed:
And found in:
You can use in Python like: