Improved Python 3 compatibility.

Added Exception type at the urllib import statement.
raw_input() was replaced by input() in Python 3, so NameError exception will be raised in Python 3 and input() would be used instead.