I have a zip file at my GitHub repo. I want to load it into my Google Colab files. I have it's url from where it can be dowloaded like https://raw.githubusercontent.com/rehmatsg/../master/...zip
I used this method to download file into Google Colab
from google.colab import files
url = 'https://raw.githubusercontent.com/user/.../master/...zip'
files.download(url)
But I get this error
FileNotFoundError Traceback (most recent call last)
<ipython-input-5-c974a89c0412> in <module>()
3 from google.colab import files
4
----> 5 files.download(url)
/usr/local/lib/python3.7/dist-packages/google/colab/files.py in download(filename)
141 raise OSError(msg)
142 else:
--> 143 raise FileNotFoundError(msg) # pylint: disable=undefined-variable
144
145 comm_manager = _IPython.get_ipython().kernel.comm_manager
FileNotFoundError: Cannot find file: https://raw.githubusercontent.com/user/.../master/...zip
Files in Google Colab are temporary, so I cannot upload it each time. This is the reason I wanted to host the file in my project's GitHub repo. What would be the correct method to download the file into Google Colab?
Use the "wget" bash command. Just open the Github project and go to the download as zip option (at top right). Then, copy the url and use "wget" command.
!wget https://github.com/nytimes/covid-19-data/archive/refs/heads/master.zip
!unzip /content/master.zip
good luck.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With