Q:

Invalid syntax socket.socket

I've been following the tutorial about python socket'ing from http://www.binarytides.com/python-socket-programming-tutorial/ and modified the source code a bit, to create a client and server script. The server is running without problems as far as i have tested. But the client is giving me a hard time with a not undestandable invalid syntax error:
File "client.py", line 17
....try :
.....     ^  
Here is my source code:

#!/usr/bin/env python
import socket, select, string, sys

#***** prompt *****
def prompt() :
sys.stdout.write('<You> ')
sys.stdout.flush()

#***** main func *****
if __name__ == "__main__":
#if(len(sys.argv) < 3) :
#    print ("Usage : python telnet.py hostname port")
#    sys.exit()

HOST = raw_input("Enter host:\n")
PORT = int(raw_input("Enter port:\n")
try : 
    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)  
    s.settimeout(2)
except socket.error, msg:
    print("Failed to create socket. Error code: " + str(msg[0]) + " , Error message: " + msg[1]  

#***** connect to remote host *****
try :
    s.connect((HOST, PORT))
except :    
    print ("Unable to connect")
    sys.exit()

print ("Connected to remote host. Start sending messages")
prompt()

while 1:
    socket_list = [sys.stdin, s]

    #*****  Get the list sockets which are readable *****
    read_sockets, write_sockets, error_sockets = select.select(socket_list , [], [])

    for sock in read_sockets:
        #***** incoming message from remote server *****
        if sock == s:
            data = sock.recv(4096)
            if not data :
                print ("\nDisconnected from chat server")
                sys.exit()
            else :
                #print data
                sys.stdout.write(data)
                prompt()

        #***** user entered a message *****
        else :
            msg = sys.stdin.readline()
            s.send(msg)

A:

The line 
PORT = int(raw_input("Enter port:\n")

is missing the closing ).
Rule of thumb: weird syntax error -> look in the line above.

