1

Looks good here:

except socket.error, err:
     raise urllib2.URLError(err)

But gives this error at runtime:

    except Exception, e:
                    ^
SyntaxError: invalid syntax

Using Python 3.3 and Eclipse 5.0

Any suggestions for me? Do I need to reinstall the Interpreter?

Hank
  • 21
  • 4

1 Answers1

3

You are using the Python 2 except syntax. Instead, try

except socket.err as err:
    raise urllib2.URLError(err)

See here for more info about exceptions, errors, and how to handle them. You can also use the Python 3 syntax in Python 2.6 and 2.7, as it was back-ported.

MattDMo
  • 100,794
  • 21
  • 241
  • 231