See http://www.python.org/doc/ref/try.html#l2h-439 for the syntax of try/except. "except socket.error, why" assigns the value raised with the exception to the name "why". Play with this a bit: >>> try: raise SyntaxError('example') ... except SyntaxError, why: print why ... example >>> Alex.