[Ironpython-users] System.Net.WebClient and urllib.urlretrieve fail to download a file
Djordje Spasic
issworld2000 at yahoo.com
Tue Feb 14 18:49:10 EST 2017
Hello,I have a small ironpython 2.7 function which downloads a particular .osm file from overpass-api.de website.
The function is working without a problem on my PC.
However, on PC of another person, it fails. That person is using Windows 10 x64 (not sure if this information is of any significance), while I am using Windows XP 32 bit (way too old, sorry for that).
Here is the function's code:
import Systemimport urllib def downloadFile(downloadLink,downloadedFilePath): try: # try "secure http" download client = System.Net.WebClient() client.DownloadFile(downloadLink,downloadedFilePath) except Exception, e: print "e1: ", e try: # "secure http" failed, try"http" download: filePath, infoHeader = urllib.urlretrieve(downloadLink,downloadedFilePath) except Exception, e: print "e2: ", e # downloading of file failed fileDownloaded_success = False return fileDownloaded_success fileDownloaded_success = True return fileDownloaded_success download = True # switchif download == True: downloadLink = "http://overpass-api.de/api/map?bbox=-74.0118232808,40.7028304899,-74.0094567192,40.7046315099" downloadedFilePath = "c:/map.osm" fileDownloaded_success = downloadFile(downloadLink,downloadedFilePath) print"fileDownloaded_success: ",fileDownloaded_success
Mentioned person gets the following printed to his console, after running the code:
e1: Unable to connect to the remote server
e2: [Errno socket error] getaddrinfo returns an empty list
fileDownloaded_success: False
He tried turning off both his Antivirus and Windows Firewall, and the upper two error messages did not go away.
We can not use a newer version of IronPython, as 2.7 is what is shipped with Rhino5 application (we basically use IronPython 2.7 editor inside Rhino5 application).
I would be grateful for any kind of reply, as I do not know what is the problem at his place. I did some googling with similar error message, but I do not know if this could be the same situation.
Thank you in advance!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20170214/50b4b4d4/attachment.html>
More information about the Ironpython-users
mailing list