Exception when download(url) for CSV file

Hello

I tried to download a CSV file from a certain URL.
It triggers an exceptions, as show below.
In Python, using Pandas, there is no problem to donwload this file.
I could download the same file from my GitHup repository.

Do you think I could work around this problem?

Thanks

Michel

Code

url = "https://opendata.ecdc.europa.eu/covid19/nationalcasedeath_eueea_daily_ei/csv/data.csv"
file = CSV.File(download(url), missingstring= "NA")
df = DataFrame(file)

Exception

Exception calling β€œDownloadFile” with β€œ2” argument(s): β€œThe request was aborted: Could not create SSL/TLS secure channel.”
At line:1 char:96

  • [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtoco …
    • CategoryInfo : NotSpecified: , MethodInvocationException
    • FullyQualifiedErrorId : WebException

failed process: Process('C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe' -Version 3 -NoProfile -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; (New-Object System.Net.Webclient).DownloadFile('https://opendata.ecdc.europa.eu/covid19/nationalcasedeath_eueea_daily_ei/csv/data.csv', 'C:\Users\mjtoys\AppData\Local\Temp\jl_iVVs1d0JOb')", ProcessExited(1)) [1]

I cannot reproduce this:

(jl_BrisNc) pkg> st
      Status `C:\Users\ngudat\AppData\Local\Temp\jl_BrisNc\Project.toml`
  [336ed68f] CSV v0.9.11
  [a93c6f00] DataFrames v1.3.1

julia> using DataFrames, CSV

julia> url = "https://opendata.ecdc.europa.eu/covid19/nationalcasedeath_eueea_daily_ei/csv/data.csv"
"https://opendata.ecdc.europa.eu/covid19/nationalcasedeath_eueea_daily_ei/csv/data.csv"

julia> CSV.read(download(url), DataFrame; missingstring = "NA")
9150Γ—11 DataFrame
  Row β”‚ dateRep     day    month  year   cases   deaths  countriesAndTerritories  geoId    countryterritoryCode  popData2020  continentExp 
      β”‚ String15    Int64  Int64  Int64  Int64   Int64   String15                 String3  String3               Int64        String7      
──────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
    1 β”‚ 10/01/2022     10      1   2022   10860       2  Austria                  AT       AUT                       8901064  Europe
    2 β”‚ 09/01/2022      9      1   2022    7171       7  Austria                  AT       AUT                       8901064  Europe
    3 β”‚ 08/01/2022      8      1   2022    9028       8  Austria                  AT       AUT                       8901064  Europe

The error seems to come from PowerShell, are you on some really old Windows version or something?

Thanks!

Very interresting!
I am on Windows 8.1 .
The same works in Python with Pandas.
Other urls, like on GitHub work well with Julia.

I guess Pandas uses another technique, probably not using PowerShell?
But I don’t see why other ursl could work in Julia?

Do you know if there would be an alternative way in Julia to download a file?

Thanks

Michel

Well that’s certainly a pretty niche operating system, and given it’s close to end-of-life there probably aren’t many people interested in fixing problems with it that can’t be replicated on other OSes.

You can try the HTTP package as shown in the CSV.jl docs:

https://csv.juliadata.org/stable/examples.html#http

1 Like

download in Julia v1.6+ shouldn’t be using PowerShell anymore.
It should be using LibCurl on all operating systems.

I suggest if possible updating you julia version to 1.7, the latest stable release.
It’s nonbreaking, and you get new features like the OS independent download functionality.

3 Likes