X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=system%2Ftcptest.py;h=5aa7b37bcf117844238d20108cd11bf3286bfbf8;hb=1f729fbf7e8fae3fe71184db41eb8b60063534ae;hp=773ecbe54f9c770aeed8ab742568c9a0c52c7581;hpb=c8e2f4e3a327181b29521583770a6f0ff68ca6eb;p=tests.git diff --git a/system/tcptest.py b/system/tcptest.py index 773ecbe..5aa7b37 100755 --- a/system/tcptest.py +++ b/system/tcptest.py @@ -11,9 +11,11 @@ import SocketServer import threading from optparse import OptionParser +from __future__ import print_function + 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 +66,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 +92,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 +160,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)