summaryrefslogtreecommitdiff
path: root/examples/domstart.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/domstart.py')
-rwxr-xr-xexamples/domstart.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/domstart.py b/examples/domstart.py
index 7ff6cb9..f342e95 100755
--- a/examples/domstart.py
+++ b/examples/domstart.py
@@ -32,8 +32,9 @@ if len(sys.argv) != 2:
(name, xmldesc) = read_domain(sys.argv[1])
-conn = libvirt.open(None)
-if conn is None:
+try:
+ conn = libvirt.open(None)
+except libvirt.libvirtError:
print('Failed to open connection to the hypervisor')
sys.exit(1)