# Can anyone help? when I tried to download a picture file from the web, I failed to do so and got the following messages:

**URL:** <https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726>\
**Category:** New to Julia\
**Created:** [December 12, 2020, 4:29pm UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726 "2020-12-12T16:29:19Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Wang1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/david_wang1/32/20228_2.png) [@David\_Wang1](https://discourse.julialang.org/u/David_Wang1)\
**Post date:** [December 12, 2020, 4:29pm UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/1 "2020-12-12T16:29:19Z")

</div>

I am following the class of " Working with images in Julia | Week 1 | 18.S191 MIT Fall 2020 | Grant Sanderson" and tried to write the code in my Julia notebook as:url = “[https://i.imgur.com/VGPeJ6s.jpg](https://i.imgur.com/VGPeJ6s.jpg)” , and "download(url, “philip.jpg”) I got the error messages as follows;

failed process: Process(`'C:\WINDOWS\System32\curl.exe' -s -S -g -L -f -o philip1.jpg https://i.imgur.com/VGPeJ6s.jpg`, ProcessExited(35)) [35]

1. **pipeline\_error** @ _process.jl:525_ [inlined]
2. **download\_curl** (::String, ::String, ::String)@ _download.jl:44_
3. **download** @ _download.jl:62_ [inlined]
4. **top-level scope** @ _[Local: 1](http://localhost:1234/edit?id=c10f8be0-3c94-11eb-18f3-4572fc88e4a4#)_ [inlined]

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [December 12, 2020, 5:38pm UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/2 "2020-12-12T17:38:59Z")

</div>

I get the same if I am not able to write into the current working directory.  
Doing a

```julia
julia> cd(raw"c:\Temp")

julia> download(url, "philip.jpg")
"philip.jpg"

```

resolved it and results in a `philip.jpg` in `c:\Temp`.  
It’s is probably the same within your notebook.  
Check what

```julia
pwd()

```

gives and try to change into some directory you have write access. This directory must be on the notebook host system, if it isn’t a local running notebook.

---

<div class="post-metadata">

**Author:** ![FedericoStra](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@FedericoStra](https://discourse.julialang.org/u/FedericoStra)\
**Post date:** [December 12, 2020, 6:09pm UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/3 "2020-12-12T18:09:39Z")

</div>

As `?download` says,

> Note that this function relies on the availability of external tools such as `curl`, `wget` or `fetch` to download the file and is provided for convenience.

So, why not just use them directly (using `;` to go into [shell mode](https://docs.julialang.org/en/v1/stdlib/REPL/#man-shell-mode))?

```julia
shell> curl -o google.html https://www.google.com/
...
shell> wget -O google.html https://www.google.com/
...

```

---

<div class="post-metadata">

**Author:** ![Skoffer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skoffer/32/378_2.png) [@Skoffer](https://discourse.julialang.org/u/Skoffer)\
**Post date:** [December 12, 2020, 7:45pm UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/4 "2020-12-12T19:45:25Z")

</div>

You can use [https://github.com/Arkoniak/UrlDownload.jl](https://github.com/Arkoniak/UrlDownload.jl) which download files without creating intermediate files.

---

<div class="post-metadata">

**Author:** ![David\_Wang1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/david_wang1/32/20228_2.png) [@David\_Wang1](https://discourse.julialang.org/u/David_Wang1)\
**Post date:** [December 13, 2020, 2:21am UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/5 "2020-12-13T02:21:36Z")

</div>

> [@FedericoStra](#):
>
> `wget -O google.html https://www.google.com/`

Thanks a lot! I tried and failed again. I got the following messages:

shell\> curl -o google.html [https://www.google.com/](https://www.google.com/)  
% Total % Received % Xferd Average Speed Time Time Time Current  
Dload Upload Total Spent Left Speed  
0 0 0 0 0 0 0 0 --:–:-- 0:00:20 --:–:-- 0curl: (7) Failed to connect to [www.google.com](http://www.google.com) port 443: Timed out

julia\> wget -O google.html [https://www.google.com/](https://www.google.com/)  
ERROR: syntax: extra token “google” after end of expression  
Stacktrace:  
[1] top-level scope at C:\Users\Ginger Jiang.julia\packages\Pluto\dcxnF\src\evaluation\WorkspaceManager.jl:0

---

<div class="post-metadata">

**Author:** ![David\_Wang1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/david_wang1/32/20228_2.png) [@David\_Wang1](https://discourse.julialang.org/u/David_Wang1)\
**Post date:** [December 13, 2020, 3:05am UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/6 "2020-12-13T03:05:22Z")

</div>

> [@oheil](#):
>
> `pwd()`

Hi, Thank you for replying to my help. I tried your way with Julia and notebook but failed again. It seems that I can’t creat file of “philip.jpg into my created c:\Temp.  
julia\> pwd()  
“c:\Temp”  
julia\> cd(raw"c:\Temp”)  
julia\> download(url, “philip.jpg”)  
ERROR: UndefVarError: url not defined  
Stacktrace:  
[1] top-level scope at REPL[23]:1

julia\>

---

<div class="post-metadata">

**Author:** ![David\_Wang1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/david_wang1/32/20228_2.png) [@David\_Wang1](https://discourse.julialang.org/u/David_Wang1)\
**Post date:** [December 13, 2020, 3:08am UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/7 "2020-12-13T03:08:27Z")

</div>

Hello Skoffer,  
Thank you for replying. I have downloaded your provided link, after that I don’t know how to proceed, I am totally new about it. Please guide me further. Many thanks.

---

<div class="post-metadata">

**Author:** ![David\_Wang1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/david_wang1/32/20228_2.png) [@David\_Wang1](https://discourse.julialang.org/u/David_Wang1)\
**Post date:** [December 13, 2020, 6:57am UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/8 "2020-12-13T06:57:48Z")

</div>

Hi oheil,  
I just find a way to download that dog picture into my C:\Temp location as you suggested I should create. Now bypass that direct method, so the problem half solved! I can continue to work with that file without so much frustration. Thank you very much for your kind help!

---

<div class="post-metadata">

**Author:** ![Skoffer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skoffer/32/378_2.png) [@Skoffer](https://discourse.julialang.org/u/Skoffer)\
**Post date:** [December 13, 2020, 10:40am UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/9 "2020-12-13T10:40:40Z")

</div>

Usage is straightforward.

First you need to install package itself

```julia
using Pkg
Pkg.add("UrlDownload")
Pkg.add("ImageMagick")

```

After that, you can use it as

```julia
using UrlDownload

img = urldownload("https://i.imgur.com/VGPeJ6s.jpg")

```

---

<div class="post-metadata">

**Author:** ![FedericoStra](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@FedericoStra](https://discourse.julialang.org/u/FedericoStra)\
**Post date:** [December 13, 2020, 5:34pm UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/10 "2020-12-13T17:34:18Z")

</div>

It appears you are using windows and not linux. I don’t know (or care about) the syntax to use curl/wget under windows, but you can surely find it online.

---

<div class="post-metadata">

**Author:** ![David\_Wang1](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/david_wang1/32/20228_2.png) [@David\_Wang1](https://discourse.julialang.org/u/David_Wang1)\
**Post date:** [December 14, 2020, 1:01pm UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/11 "2020-12-14T13:01:28Z")

</div>

![pic1](https://global.discourse-cdn.com/julialang/original/3X/c/1/c16c7c44c75b679405eac7a2cb762867ed36e628.png) ![pic2](https://global.discourse-cdn.com/julialang/original/3X/e/5/e562e7329e7152ba40c30ae32f3f56889f288e4a.png)  
Hi Skoffer,  
Thanks very much for taking the time to help me. After installed UrlDownload, I followed your method and I got the system response as per attached two pictures. Any further suggestions?

---

<div class="post-metadata">

**Author:** ![Skoffer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/skoffer/32/378_2.png) [@Skoffer](https://discourse.julialang.org/u/Skoffer)\
**Post date:** [December 14, 2020, 1:09pm UTC](https://discourse.julialang.org/t/can-anyone-help-when-i-tried-to-download-a-picture-file-from-the-web-i-failed-to-do-so-and-got-the-following-messages/51726/12 "2020-12-14T13:09:44Z")

</div>

It looks like you have some issues with your network connection, as it is written in error message “connection reset by peer”
