summaryrefslogtreecommitdiff
path: root/examples/domsave.py
diff options
context:
space:
mode:
Diffstat (limited to 'examples/domsave.py')
-rwxr-xr-xexamples/domsave.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/domsave.py b/examples/domsave.py
index 4940cce..f8922d6 100755
--- a/examples/domsave.py
+++ b/examples/domsave.py
@@ -18,8 +18,9 @@ if len(sys.argv) != 2:
dir = 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)