views:

63

answers:

2

Choking code:

while port < 0 or port > 65535:
    try:
        port = int(raw_input("Enter port: ")
    except ValueError:
        print "Invalid port number."

Result:

  File "/Users/.../Documents/.../CS 176A/TCPServer.py", line 10
    except ValueError:
         ^
SyntaxError: invalid syntax
+4  A: 

Missing right parenthesis. Change to port = int(raw_input("Enter port: "))

Manoj Govindan
Thanks. Not seeing clearly.
Brian D
by 9 seconds. that was down to the wire.
aaronasterling
@Aaron: =P #padding to post the comment.
Manoj Govindan
Haha yeah, you guys are both pretty fast.. good work.
Brian D
+1  A: 

BTW, as a rule, whenever you receive interpreter/compiler errors, start looking for problems one line before the reported line.

bgbg
Yeah, that's a good tip. I was focused on the except, thinking it was my version of python or something not imported... thanks.
Brian D