1
0
mirror of https://gitlab.com/libvirt/libvirt-python.git synced 2025-08-04 12:21:57 +03:00

examples: Invoke print("...") instead of print "..."

The 'print' method must be called as a function in python3,
ie with brackets.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange
2013-12-03 15:34:56 +00:00
parent bb3301ba78
commit 3f4e32c6a1
8 changed files with 82 additions and 85 deletions

View File

@ -8,15 +8,15 @@ import libxml2
import pdb
def usage():
print 'Usage: %s DOMAIN' % sys.argv[0]
print ' Print information about the domain DOMAIN'
print('Usage: %s DOMAIN' % sys.argv[0])
print(' Print information about the domain DOMAIN')
def print_section(title):
print "\n%s" % title
print "=" * 60
print("\n%s" % title)
print("=" * 60)
def print_entry(key, value):
print "%-10s %-10s" % (key, value)
print("%-10s %-10s" % (key, value))
def print_xml(key, ctx, path):
res = ctx.xpathEval(path)
@ -36,14 +36,14 @@ name = sys.argv[1]
# Connect to libvirt
conn = libvirt.openReadOnly(None)
if conn is None:
print 'Failed to open connection to the hypervisor'
print('Failed to open connection to the hypervisor')
sys.exit(1)
try:
dom = conn.lookupByName(name)
# Annoyiingly, libvirt prints its own error message here
except libvirt.libvirtError:
print "Domain %s is not running" % name
print("Domain %s is not running" % name)
sys.exit(0)
info = dom.info()