I am trying to download github dataset from here:
https://raw.githubusercontent.com/heyunh2015/PARADE_dataset/main/PARADE_test.txt
using a windows machine, and the anaconda host to play jupyter notebook, I am trying to directly download it in the machine using the following command:
!wget https://raw.githubusercontent.com/heyunh2015/PARADE_dataset/main/PARADE_test.txt
However, it is giving me the following error:
'wget' is not recognized as an internal or external command, operable program or batch file.
Then I tried again after the following command:
!pip install wget
still the same error.
Next, I tried curl
, and the error went away, but I am unable to access my downloaded file either through code (the file doesn't exist) or using GUI (doesn't show up in the current working directory).
What to do?
CodePudding user response:
I got my answer.
import wget
url = "<source>"
wget.download(url, '<destination>')
CodePudding user response:
wget not working in annaconda jupyter notebook - Windows. Alternative?
python
's standard library has function for downloading files, called urlretrieve
inside urllib.request
. Simple usage example
import urllib.request
urllib.request.urlretrieve("https://raw.githubusercontent.com/heyunh2015/PARADE_dataset/main/PARADE_test.txt","PARADE_test.txt")
Explanation: 2 arguments are provided, URL and filename. Note that in this form this does not report progress. You need to wait until it finishes. If you must have see linked docs for discussion of 3rd argument to urllib.request.urlretrieve