PEP 3105 removed the print statement in favour of a print function.
Replace usage of the old statement with equivalent functionality that
works in both python2.7 and python3.
Signed-off-by: Joe Stringer <joe@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
if get_log_destination() == 'syslog':
syslog.syslog(s)
else:
- print >>sys.stderr, s
+ sys.stderr.write(s + '\n')
+ sys.stderr.flush()
#
# Exceptions.
elif o == "--no-syslog":
set_log_destination("stderr")
elif o == "-h" or o == "--help":
- print __doc__ % {'command-name': os.path.basename(argv[0])}
+ print(__doc__ % {'command-name': os.path.basename(argv[0])})
return 0
if get_log_destination() == "syslog":
db().save(dbcache_file)
except Usage as err:
- print >>sys.stderr, err.msg
- print >>sys.stderr, "For help use --help."
+ sys.stderr.write(err.msg + "\n")
+ sys.stderr.write("For help use --help.\n")
+ sys.stderr.flush()
return 2
except Error as err:
log(err.msg)