Browse code

Provide more helpful error message when gi import fails.

It's a common problem for those installing xdot.py from PyPI, as it's
not available there, hence we can't depend upon it.

See also:
- https://github.com/jrfonseca/xdot.py/issues/88
- https://github.com/jrfonseca/xdot.py/issues/42

Jose Fonseca authored on 10/01/2021 10:31:51
Showing 1 changed files

... ...
@@ -1,3 +1,11 @@
1 1
 __all__ = ['actions', 'animation', 'colors', 'elements', 'pen', 'window']
2 2
 
3
+import sys
4
+
5
+try:
6
+    import gi
7
+except ImportError:
8
+    sys.stderr.write('error: PyGObject bindings for GTK3 not found (https://git.io/JLjeE)\n')
9
+    sys.exit(1)
10
+
3 11
 from .window import DotWidget, DotWindow