summaryrefslogtreecommitdiff
path: root/examples/esxlist.py
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2013-12-03 15:34:56 +0000
committerDaniel P. Berrange <berrange@redhat.com>2013-12-11 16:12:54 +0000
commit3f4e32c6a1c994cec9d24767703da40e4c28bead (patch)
tree50efa7409ec5b7eb6a900413e3fa5312abeee5b5 /examples/esxlist.py
parentbb3301ba7851de2e00e8a6162bcc4282db7cf75e (diff)
downloadlibvirt-python-3f4e32c6a1c994cec9d24767703da40e4c28bead.tar.gz
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>
Diffstat (limited to 'examples/esxlist.py')
-rwxr-xr-xexamples/esxlist.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/esxlist.py b/examples/esxlist.py
index c55424f..0d47b00 100755
--- a/examples/esxlist.py
+++ b/examples/esxlist.py
@@ -10,8 +10,8 @@ import getpass
def usage():
- print "Usage: %s HOSTNAME" % sys.argv[0]
- print " List active domains of HOSTNAME and print some info"
+ print("Usage: %s HOSTNAME" % sys.argv[0])
+ print(" List active domains of HOSTNAME and print some info")
# This is the callback method passed to libvirt.openAuth() (see below).
@@ -51,12 +51,12 @@ def request_credentials(credentials, user_data):
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):
@@ -100,7 +100,7 @@ auth = [[libvirt.VIR_CRED_AUTHNAME, libvirt.VIR_CRED_NOECHOPROMPT],
conn = libvirt.openAuth(uri, auth, 0)
if conn is None:
- print "Failed to open connection to %s" % hostname
+ print("Failed to open connection to %s" % hostname)
sys.exit(1)
state_names = { libvirt.VIR_DOMAIN_RUNNING : "running",
@@ -136,7 +136,7 @@ for id in conn.listDomainsID():
ctx.setContextNode(d)
if not first:
- print "------------------------------------------------------------"
+ print("------------------------------------------------------------")
else:
first = False