Update print syntax
authorBen Steffen <bds@mit.edu>
Wed, 8 Jan 2020 03:24:16 +0000 (22:24 -0500)
committerBen Steffen <bds@mit.edu>
Wed, 8 Jan 2020 03:32:16 +0000 (22:32 -0500)
python/invirt/remctl.py
scripts/invirt-getconf
scripts/invirt-mako-render

index 9dbe8bd..1295eac 100644 (file)
@@ -41,7 +41,7 @@ def remctl(host, *args, **kws):
     if kws.get('err'):
         return stdout, stderr
     if p.returncode:
-        print >> sys.stderr, 'Error', p.returncode, 'on remctl', args, ':'
-        print >> sys.stderr, stderr
+        print('Error', p.returncode, 'on remctl', args, ':', file=sys.stderr)
+        print(stderr, file=sys.stderr)
         raise CodeError('ERROR on remctl')
     return stdout
index 4e319af..ea72367 100755 (executable)
@@ -68,18 +68,18 @@ def main(argv):
                         % '.'.join(components))
             if type(conf) == list:
                 for i in xrange(len(conf)):
-                    print i
+                    print(i)
             else:
                 for k in conf.iterkeys():
-                    print k
+                    print(k)
         else:
             if type(conf) not in (dict, list):
-                print conf
+                print(conf)
             else:
                 yaml.dump(conf, stdout,
                           Dumper=yaml.CSafeDumper, default_flow_style=False)
-        print >> stderr, ex
     except invirt_exception as ex:
+        print(ex, file=stderr)
         return 1
 
 if __name__ == '__main__':
index e728ad1..c8dcc5a 100755 (executable)
@@ -34,7 +34,7 @@ def main(argv=None):
         fo = open(filename)
 
     data = fo.read()
-    print render(data)
+    print(render(data))
 
 if __name__ == "__main__":
     main()