The wget command should work in Jupyter Notebook of VS Code as well since it worked in Google Colab.
Asked
Active
Viewed 808 times
0
-
[Here's how to ask a proper "Where's the bug / Fix my code" question](https://meta.stackoverflow.com/a/253788/11107541). Can you please read it and apply what you learn to improve your question? You can also read [ask] for further guidance. I know this isn't a questoin about code with a bug, but very similar guidance still applies. For example, look at your title. – starball Jan 05 '23 at 10:31
-
2It's likely that you haven't installed `wget` on your Windows machine. [Check out this guide](https://www.jcchouinard.com/wget/#Download_Wget_on_Windows) on how to install it. – AnsonH Jan 05 '23 at 11:22
-
Does this answer your question? [wget not recognized as internal or external command](https://stackoverflow.com/questions/29113456/wget-not-recognized-as-internal-or-external-command) – Gino Mempin Jan 05 '23 at 12:12
-
2This isn't related to VS Code. `wget` is a system command, not a jupyter notebook command and not a VS Code command. `!wget` tells jupyter notebook to pass the `wget` command to the underlying system, so if your system doesn't have wget, then it fails. Windows doesn't have wget built-in. Google Colab is a Linux system underneath, which most likely has wget pre-installed. – Gino Mempin Jan 05 '23 at 12:16
1 Answers
1
You need to have wget
installed in order to use it. Relying on external command might cause issues like one that you have encountered. If you want your code to be portable, then avoid relying on such command if possible.
Python standard library has function urllib.request.urlretrieve
which will download file for you and is easy to use, consider following simple example
from urllib.request import urlretrieve
urlretrieve("https://www.example.com","example.html")
which does download Example Domain page and save it as example.html
in current working directory

Daweo
- 31,313
- 3
- 12
- 25