2

This is the code being used:

import wget

firefox_29 = "https://ftp.mozilla.org/pub/firefox/releases/29.0.1/win32/en-
US/Firefox%20Setup%2029.0.1.exe"

firefox_dir = 'C:\\firefox\\firefox29'

wget.download(firefox_29, out=firefox_dir)

This is the error I get, I've used wget before in the same way and it's worked fine so I'm confused as to why this error occurs. Also the link is a working link.

enter image description here

John Foster
  • 59
  • 1
  • 6

2 Answers2

6

I also faced the same problem before some minutes, so found this question. I first installed wget with

pip install wget

then I faced this problem... After digging a little, I uninstalled it, with...

pip uninstall wget

And then used...

pip install python3-wget

The problem was solved.

Sawradip Saha
  • 1,151
  • 11
  • 14
  • Would appreciate some more context, what did you find in your digging? `python3-wget` doesn't even have a [formal release](https://pypi.org/project/python3-wget/#history), so I'd guess it's not the best idea for production code. – Joey Baruch Aug 12 '21 at 01:16
0

I managed to figure it out without using wget. Apparently wget is just a wrapper for urllib. So I used urlretrieve instead. Heres the code:

import urllib.request

firefox_29 = "https://ftp.mozilla.org/pub/firefox/releases/29.0.1/win32/en-
US/Firefox%20Setup%2029.0.1.exe"

urllib.request.urlretrieve(firefox_29, 'firefox29.exe')

However this just renames the .exe to "firefox29.exe", so if you need it downloaded to a specific location you just have to move it yourself.

John Foster
  • 59
  • 1
  • 6