python file downloader not working

dieter dieter at handshake.de
Wed Jul 26 02:46:32 EDT 2017


Rahul Sircar <devilsgrin94 at gmail.com> writes:

> So I recently tried to write a script using urllib2 module.
> Here is the code below:
> import urllib2
> file = 'metasploitable-linux-2.0.0.zip'
> url='https://downloads.sourceforge.net/project/metasploitable/Metasploitable2/metasploitable-linux-2.0.0.zip'
> response = urllib2.urlopen(url)
> fh=open(file,'w')
> fh.write(response.read())
> fh.close()
>
> I am getting this error in the output.
> Traceback (most recent call last):
> ...
>     v = self._sslobj.read(len)
> socket.error: [Errno 10053] An established connection was aborted by the software in your host machine.

This error tells you that the server (i.e.
"downloads.sourcefourge.net") has closed the connection.

This can happen occationally. Should the error persist, something
may be wrong/special with your network/firewall.

You may try an alternative way to download the file.
On my "*nix" platform, I would use the command "wget" for a download
trial. You could also try a browser.




More information about the Python-list mailing list