lundi 18 juillet 2016

python connection reset by peer on mac

I have a small python program as below

#coding:utf-8
#! /usr/bin/python
import urllib2

head= 'https://www.nass.usda.gov/Research_and_Science/Cropland/metadata/XMLs_'
tail='.zip'

year=2000
while year<2016:
    url = head + str(year) + tail
    print url
    try:
        result = urllib2.urlopen(url).read()
    except Exception as e:
       print e

    year = year + 1

If I run this program on Mac, it happens connection reset by peer, however it runs well on windows. Environment:
mac OS X 10.11.1
window 7
python 2.7
they are in the same LAN
Could you tell me why and how to solve it?

Aucun commentaire:

Enregistrer un commentaire