So, My code is only 4 lines. I am trying to connect to a website, what I am trying to do after that is irrelevant because the error arised without the other codes.
This is an issue with DNS; apparently your python program cannot resolve the hostname of the URL you provide. Maybe DNS is badly configured on the host it is running on?
Additionally, may I recommend using the requests library? This is a much nicer and easier to use module to do web requests. You'll find it here: https://pypi.python.org/pypi/requests
This means that either your DNS system is not working correctly, or you have to use a proxy on your network and it isn't defined correctly.
If you need to use a proxy, set the environment variable HTTP_PROXY
(and optionally, HTTPS_PROXY
) to the correct configuration for your network. The format is http://proxy.example.com:80
; if your proxy needs a username and password, you should pass it in, like this: http://username:password@proxy.example.com:80
.
For DNS issues, try looking up the domain from the command line. Open a command prompt and type nslookup python-data.dr-chuck.net
and see if it returns to you an IP address.