Why can't I get Python's urlopen() method to work on Windows?

前端 未结 4 1488
一生所求
一生所求 2020-12-04 02:16

Why isn\'t this simple Python code working?

import urllib
file = urllib.urlopen(\'http://www.google.com\')
print file.read()

This is the er

4条回答
  •  天涯浪人
    2020-12-04 02:37

    If you have wireshark, check what's being sent out and if there is anything coming back at all. It will help you debug the problem if you can see the GET request being sent.

    Also i remember having similar problem like this once, what i did was flush my dns cache

    (ipconfig /flushdns) and restarted. It fixed my problem. It doesn't hurt to try i guess.

提交回复
热议问题