From: Kyr Shatskyy Date: Mon, 7 Oct 2019 14:09:45 +0000 (+0200) Subject: ceph-volume: use python3 compatible print X-Git-Tag: v15.1.0~1226^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=4f588c8201c7db750f607a35a58552c6d4e4edde;p=ceph-ci.git ceph-volume: use python3 compatible print Signed-off-by: Kyr Shatskyy --- diff --git a/src/ceph-volume/ceph_volume/decorators.py b/src/ceph-volume/ceph_volume/decorators.py index f6777281795..95acce064fe 100644 --- a/src/ceph-volume/ceph_volume/decorators.py +++ b/src/ceph-volume/ceph_volume/decorators.py @@ -29,9 +29,9 @@ def catches(catch=None, handler=None, exit=True): def bar(): try: some_call() - print "Success!" + print("Success!") except TypeError, exc: - print "Error while handling some call: %s" % exc + print("Error while handling some call: %s" % exc) sys.exit(1) You would need to decorate it like this to have the same effect:: @@ -39,7 +39,7 @@ def catches(catch=None, handler=None, exit=True): @catches(TypeError) def bar(): some_call() - print "Success!" + print("Success!") If multiple exceptions need to be caught they need to be provided as a tuple:: @@ -47,7 +47,7 @@ def catches(catch=None, handler=None, exit=True): @catches((TypeError, AttributeError)) def bar(): some_call() - print "Success!" + print("Success!") """ catch = catch or Exception diff --git a/src/ceph-volume/ceph_volume/util/disk.py b/src/ceph-volume/ceph_volume/util/disk.py index 97799466434..ab26359d929 100644 --- a/src/ceph-volume/ceph_volume/util/disk.py +++ b/src/ceph-volume/ceph_volume/util/disk.py @@ -534,9 +534,9 @@ class Size(object): >>> s.mb - >>> print "Total size: %s" % s.mb + >>> print("Total size: %s" % s.mb) Total size: 2211.00 MB - >>> print "Total size: %s" % s + >>> print("Total size: %s" % s) Total size: 2.16 GB """