X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2Ftcptest.py;h=abdc6fb3acf480bd67ca60fb98c414163e223c66;hb=6ab88413a3755a9e6d0e8b66e0a662df7c192e21;hp=773ecbe54f9c770aeed8ab742568c9a0c52c7581;hpb=c8e2f4e3a327181b29521583770a6f0ff68ca6eb;p=tests.git diff --git a/system/tcptest.py b/system/tcptest.py index 773ecbe..abdc6fb 100755 --- a/system/tcptest.py +++ b/system/tcptest.py @@ -3,6 +3,14 @@ # Thierry Parmentelat # Copyright (C) 2010 INRIA # + +# this is a small and simple standalone utility +# designed to run in slice-space +# we keep this in python2 for now until python3 +# can be taken for granted in sliceimage + +from __future__ import print_function + import sys import time import subprocess @@ -13,7 +21,7 @@ from optparse import OptionParser def myprint(message, id='client'): now = time.strftime("%H:%M:%S", time.localtime()) - print "* {now} ({id}) -- {message}".format(**locals()) + print("* {now} ({id}) -- {message}".format(**locals())) sys.stdout.flush() def show_network_status(id): @@ -64,7 +72,7 @@ class Server: else: server.serve_forever() except KeyboardInterrupt as e: - print 'Bailing out on keyboard interrupt' + print('Bailing out on keyboard interrupt') sys.exit(1) class Ready: @@ -90,7 +98,7 @@ class Ready: s.bind((options.address, options.port)) return True except Exception as e: - print e + print(e) return False def eth0_has_ipv4(): @@ -158,5 +166,5 @@ if __name__ == '__main__': elif arg.find("ready") >= 0: sys.argv.remove(arg) Ready().main() - print 'you must specify either --client or --server' + print('you must specify either --client or --server') sys.exit(1)