diff options
author | Collin Winter <collinw@gmail.com> | 2007-07-17 20:59:35 (GMT) |
---|---|---|
committer | Collin Winter <collinw@gmail.com> | 2007-07-17 20:59:35 (GMT) |
commit | 6f2df4d5e193d54244b0c2de91ef0ab1604b9243 (patch) | |
tree | 5e172400da7561eb4bb8fafc62c8cab511d74dad /Demo/pysvr/pysvr.py | |
parent | a8c360ee76fb76902a2e2140fbb38d4b06b2d9fb (diff) | |
download | cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.zip cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.tar.gz cpython-6f2df4d5e193d54244b0c2de91ef0ab1604b9243.tar.bz2 |
Run 2to3 over the Demo/ directory to shut up parse errors from 2to3 about lingering print statements.
Diffstat (limited to 'Demo/pysvr/pysvr.py')
-rwxr-xr-x | Demo/pysvr/pysvr.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Demo/pysvr/pysvr.py b/Demo/pysvr/pysvr.py index b1b7565..b200fad 100755 --- a/Demo/pysvr/pysvr.py +++ b/Demo/pysvr/pysvr.py @@ -20,7 +20,7 @@ def main(): try: opts, args = getopt.getopt(sys.argv[1:], "") if len(args) > 1: - raise getopt.error, "Too many arguments." + raise getopt.error("Too many arguments.") except getopt.error as msg: usage(msg) for o, a in opts: @@ -37,32 +37,32 @@ def main(): def usage(msg=None): sys.stdout = sys.stderr if msg: - print msg - print "\n", __doc__, + print(msg) + print("\n", __doc__, end=' ') sys.exit(2) def main_thread(port): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.bind(("", port)) sock.listen(5) - print "Listening on port", port, "..." + print("Listening on port", port, "...") while 1: (conn, addr) = sock.accept() if addr[0] != conn.getsockname()[0]: conn.close() - print "Refusing connection from non-local host", addr[0], "." + print("Refusing connection from non-local host", addr[0], ".") continue thread.start_new_thread(service_thread, (conn, addr)) del conn, addr def service_thread(conn, addr): (caddr, cport) = addr - print "Thread %s has connection from %s.\n" % (str(thread.get_ident()), - caddr), + print("Thread %s has connection from %s.\n" % (str(thread.get_ident()), + caddr), end=' ') stdin = conn.makefile("r") stdout = conn.makefile("w", 0) run_interpreter(stdin, stdout) - print "Thread %s is done.\n" % str(thread.get_ident()), + print("Thread %s is done.\n" % str(thread.get_ident()), end=' ') def run_interpreter(stdin, stdout): globals = {} @@ -110,7 +110,7 @@ def run_command(code, stdin, stdout, globals): try: exec(code, globals) except SystemExit as how: - raise SystemExit, how, sys.exc_info()[2] + raise SystemExit(how).with_traceback(sys.exc_info()[2]) except: type, value, tb = sys.exc_info() if tb: tb = tb.tb_next |